Read in phenotypic data

# Read in data
pheno <- read.csv("NC13955_Combined_Data_Final.csv")

# Read in potential selfs
selfs <- read.csv("list_of_potential_selfs.csv")

# Remove selfs
pheno <- pheno %>%
  filter(!GENOTYPE %in% selfs$GENOTYPE)

# Ensure the correct data types
pheno[, 1:7] <- lapply(pheno[, 1:7], as.factor)
pheno[, 8:ncol(pheno)] <- lapply(pheno[, 8:ncol(pheno)], as.numeric)

Calculate BLUEs within and across environments

# Set up lists for loop
env <- levels(pheno$ENV)
traits <- colnames(pheno)[8:12]

# Create dataframe for means output
BLUEs_loc <- data.frame(GENOTYPE = unique(pheno$GENOTYPE))

# Run models for each environment
for (i in env) {
  for (j in traits) {
    # Print message
    print_message <- paste("### Analyzing", j, "in", i, "###")
    print(paste(rep("#", nchar(print_message)), collapse = ""))
    print(print_message)
    print(paste(rep("#", nchar(print_message)), collapse = ""))
    
    # Read subset of phenotype data
    pheno_subset <- na.omit(pheno[pheno$ENV == i, c("GENOTYPE", "REP", j)])
    colnames(pheno_subset)[3] <- "Y"
    
    # Check if subset is empty
    if (nrow(na.omit(pheno_subset)) == 0) {
      # Throw message
      print(paste("###", j, "not taken in", i, "moving on..."))
      remove(pheno_subset)
      next
    }
    if (j %in% c("FHB", "FDK", "DON")) {
      # Run model and pull estimates
      fit <- asreml(fixed = Y ~ GENOTYPE,
                    random = ~ REP,
                    residual = ~ units,
                    data = pheno_subset,
                    family = asr_poisson(),
                    maxit = 75)
      
      # Check if model converges and if it doesn't, default to RCBD with normal distribution
      if (fit$converge == FALSE | (i == "WAR20" & j == "FHB")) {
        # Fit model
        fit <- asreml(fixed = Y ~ GENOTYPE,
                      random = ~ REP,
                      residual = ~ units,
                      data = pheno_subset,
                      maxit = 75)
        # Update model
        fit <- update.asreml(fit)
      }
      
      # Get quick summary      
      print(summary(fit))
      print(plot(fit))
      
      # Pull BLUEs
      pred <- predict(fit, classify = "GENOTYPE", maxit = 75)$pvals[, c("GENOTYPE", "predicted.value")]
      
      # Rename
      colnames(pred)[2] <- paste(j, "_", i, sep = "")
      
      # Bind
      BLUEs_loc <- left_join(BLUEs_loc, pred, by = "GENOTYPE")
    } else {
      # Run model and pull estimates 
      fit <- asreml(fixed = Y ~ GENOTYPE,
                    random = ~ REP,
                    residual = ~ units,
                    data = pheno_subset)
      
      # Get BLUEs
      pred <- predict(fit, classify = "GENOTYPE")$pvals[, c("GENOTYPE", "predicted.value")]
      
      # Rename
      colnames(pred)[2] <- paste(j, "_", i, sep = "")
      
      # Bind
      BLUEs_loc <- left_join(BLUEs_loc, pred, by = "GENOTYPE")      
    }
    # Remove temporary objects
    remove(pheno_subset, fit, pred)
  }
}
## [1] "#############################"
## [1] "### Analyzing HD in KIN19 ###"
## [1] "#############################"
## [1] "### HD not taken in KIN19 moving on..."
## [1] "##############################"
## [1] "### Analyzing FHB in KIN19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:08
##           LogLik        Sigma2     DF     wall
##  1      21.74295           1.0    131   11:49:08  (  1 restrained)
##  2      22.95430           1.0    131   11:49:08  (  1 restrained)
##  3      23.50873           1.0    131   11:49:08  (  1 restrained)
##  4      23.57320           1.0    131   11:49:08  (  1 restrained)
##  5      23.57756           1.0    131   11:49:08  (  1 restrained)
##  6      23.57785           1.0    131   11:49:08
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 23.72
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 131 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 23.57785
## 
## $nedf
## [1] 131
## 
## $sigma
## [1] 1
## 
## $varcomp
##            component std.error z.ratio bound %ch
## REP     1.011929e-07        NA      NA     B  NA
## units!R 1.000000e+00        NA      NA     F   0
## 
## $bic
## [1] -42.28049
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -45.15569
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 23.72133
## 
## $heterogeneity
## [1] 0.1810788
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:09
##           LogLik        Sigma2     DF     wall
##  1      23.59471           1.0    131   11:49:09
##  2      23.57785           1.0    131   11:49:09
##  3      23.57785           1.0    131   11:49:09
##  4      23.57785           1.0    131   11:49:09
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 23.72
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 131 df.
## [1] "##############################"
## [1] "### Analyzing FDK in KIN19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:09
##           LogLik        Sigma2     DF     wall
##  1     -199.9475           1.0    139   11:49:09  (  1 restrained)
##  2     -199.6005           1.0    139   11:49:09  (  1 restrained)
##  3     -199.6826           1.0    139   11:49:09
##  4     -199.3892           1.0    139   11:49:09
##  5     -199.3125           1.0    139   11:49:09
##  6     -199.3016           1.0    139   11:49:09
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 823.20
##         : Variance heterogenity factor (Deviance/df): 5.92 assuming 139 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -199.3016
## 
## $nedf
## [1] 139
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component   std.error   z.ratio bound %ch
## REP     0.001413535 0.002233495 0.6328804     P 2.5
## units!R 1.000000000          NA        NA     F 0.0
## 
## $bic
## [1] 403.5377
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 400.6032
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 823.1962
## 
## $heterogeneity
## [1] 5.922275
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:10
##           LogLik        Sigma2     DF     wall
##  1     -198.4026           1.0    139   11:49:10
##  2     -199.3009           1.0    139   11:49:10
##  3     -199.3009           1.0    139   11:49:10
##  4     -199.3009           1.0    139   11:49:10
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 823.19
##         : Variance heterogenity factor (Deviance/df): 5.92 assuming 139 df.
## [1] "##############################"
## [1] "### Analyzing DON in KIN19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:10
##           LogLik        Sigma2     DF     wall
##  1     -102.9094           1.0    139   11:49:10  (  1 restrained)
##  2     -126.8995           1.0    139   11:49:10
##  3     -130.6535           1.0    139   11:49:10
##  4     -130.6611           1.0    139   11:49:10
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 571.66
##         : Variance heterogenity factor (Deviance/df): 4.11 assuming 139 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -130.6611
## 
## $nedf
## [1] 139
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component  std.error  z.ratio bound  %ch
## REP     0.009194348 0.01132679 0.811735     P 11.4
## units!R 1.000000000         NA       NA     F  0.0
## 
## $bic
## [1] 266.2566
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 263.3221
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 571.6594
## 
## $heterogeneity
## [1] 4.112658
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:11
##           LogLik        Sigma2     DF     wall
##  1     -101.9381           1.0    139   11:49:11
##  2     -126.9168           1.0    139   11:49:11
##  3     -130.6750           1.0    139   11:49:11
##  4     -130.6760           1.0    139   11:49:11
##  5     -130.6764           1.0    139   11:49:11
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 571.65
##         : Variance heterogenity factor (Deviance/df): 4.11 assuming 139 df.
## [1] "#############################"
## [1] "### Analyzing PH in KIN19 ###"
## [1] "#############################"
## [1] "### PH not taken in KIN19 moving on..."
## [1] "#############################"
## [1] "### Analyzing HD in KIN20 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:11
##           LogLik        Sigma2     DF     wall
##  1     -292.7789      3.203751    211   11:49:11  (  1 restrained)
##  2     -291.7829      3.206980    211   11:49:11  (  1 restrained)
##  3     -291.5504      3.210761    211   11:49:11  (  1 restrained)
##  4     -291.5335      3.211284    211   11:49:11  (  1 restrained)
##  5     -291.5324      3.211319    211   11:49:11  (  1 restrained)
##  6     -291.5323      3.211322    211   11:49:11
## ASReml Version 4.2 05/07/2024 11:49:11
##           LogLik        Sigma2     DF     wall
##  1     -291.5323      3.211322    211   11:49:11
##  2     -291.5323      3.211322    211   11:49:11
##  3     -291.5323      3.211322    211   11:49:11
## [1] "##############################"
## [1] "### Analyzing FHB in KIN20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:11
##           LogLik        Sigma2     DF     wall
##  1      47.29327           1.0    210   11:49:11  (  1 restrained)
##  2      48.24621           1.0    210   11:49:11
##  3      48.24461           1.0    210   11:49:11
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 84.20
##         : Variance heterogenity factor (Deviance/df): 0.40 assuming 210 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 48.24461
## 
## $nedf
## [1] 210
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component  std.error   z.ratio bound %ch
## REP     0.006077932 0.01023055 0.5940961     P 0.1
## units!R 1.000000000         NA        NA     F 0.0
## 
## $bic
## [1] -91.14211
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -94.48922
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 84.20462
## 
## $heterogeneity
## [1] 0.4009744
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:12
##           LogLik        Sigma2     DF     wall
##  1      48.25658           1.0    210   11:49:12
##  2      48.24448           1.0    210   11:49:12
##  3      48.24448           1.0    210   11:49:12
##  4      48.24448           1.0    210   11:49:12
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 84.20
##         : Variance heterogenity factor (Deviance/df): 0.40 assuming 210 df.
## [1] "##############################"
## [1] "### Analyzing FDK in KIN20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:12
##           LogLik        Sigma2     DF     wall
##  1     -94.78738           1.0    212   11:49:12  (  1 restrained)
##  2     -93.86753           1.0    212   11:49:12
##  3     -93.89109           1.0    212   11:49:12
##  4     -93.81959           1.0    212   11:49:12
##  5     -93.81207           1.0    212   11:49:12
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 855.33
##         : Variance heterogenity factor (Deviance/df): 4.03 assuming 212 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -93.81207
## 
## $nedf
## [1] 212
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component   std.error   z.ratio bound %ch
## REP     0.003800331 0.005320064 0.7143393     P 2.9
## units!R 1.000000000          NA        NA     F 0.0
## 
## $bic
## [1] 192.9807
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 189.6241
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 855.3259
## 
## $heterogeneity
## [1] 4.034556
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:13
##           LogLik        Sigma2     DF     wall
##  1     -93.64007           1.0    212   11:49:13
##  2     -93.81209           1.0    212   11:49:13
##  3     -93.81210           1.0    212   11:49:13
##  4     -93.81210           1.0    212   11:49:13
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 855.32
##         : Variance heterogenity factor (Deviance/df): 4.03 assuming 212 df.
## [1] "##############################"
## [1] "### Analyzing DON in KIN20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:13
##           LogLik        Sigma2     DF     wall
##  1      12.18138           1.0    167   11:49:14  (  1 restrained)
##  2      10.39413           1.0    167   11:49:14
##  3      10.53455           1.0    167   11:49:14
##  4      10.61290           1.0    167   11:49:14
##  5      10.62106           1.0    167   11:49:14
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 248.45
##         : Variance heterogenity factor (Deviance/df): 1.49 assuming 167 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 10.62106
## 
## $nedf
## [1] 167
## 
## $sigma
## [1] 1
## 
## $varcomp
##          component  std.error   z.ratio bound  %ch
## REP     0.01998226 0.02337532 0.8548443     P 13.4
## units!R 1.00000000         NA        NA     F  0.0
## 
## $bic
## [1] -16.12413
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -19.24212
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 248.4495
## 
## $heterogeneity
## [1] 1.487722
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:14
##           LogLik        Sigma2     DF     wall
##  1      12.66815           1.0    167   11:49:14
##  2      10.60842           1.0    167   11:49:14
##  3      10.60717           1.0    167   11:49:14
##  4      10.60621           1.0    167   11:49:15
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 248.44
##         : Variance heterogenity factor (Deviance/df): 1.49 assuming 167 df.
## [1] "#############################"
## [1] "### Analyzing PH in KIN20 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:15
##           LogLik        Sigma2     DF     wall
##  1     -451.0904      13.78991    213   11:49:15  (  1 restrained)
##  2     -450.4711      13.85287    213   11:49:15
##  3     -450.4693      13.84757    213   11:49:15
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## ASReml Version 4.2 05/07/2024 11:49:15
##           LogLik        Sigma2     DF     wall
##  1     -450.4693      13.84715    213   11:49:15
##  2     -450.4693      13.84715    213   11:49:15
##  3     -450.4693      13.84715    213   11:49:15
## [1] "#############################"
## [1] "### Analyzing HD in RAL19 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:15
##           LogLik        Sigma2     DF     wall
##  1     -227.2095      2.609205    172   11:49:15
##  2     -226.9605      2.623647    172   11:49:15
##  3     -226.9485      2.620585    172   11:49:15
##  4     -226.9481      2.620018    172   11:49:15
## ASReml Version 4.2 05/07/2024 11:49:15
##           LogLik        Sigma2     DF     wall
##  1     -226.9481      2.619997    172   11:49:15
##  2     -226.9481      2.619997    172   11:49:15
##  3     -226.9481      2.619997    172   11:49:15
## [1] "##############################"
## [1] "### Analyzing FHB in RAL19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:15
##           LogLik        Sigma2     DF     wall
##  1      29.68725           1.0    169   11:49:15  (  1 restrained)
##  2      30.95146           1.0    169   11:49:15  (  1 restrained)
##  3      31.62021           1.0    169   11:49:15  (  1 restrained)
##  4      31.71794           1.0    169   11:49:15  (  1 restrained)
##  5      31.72481           1.0    169   11:49:15  (  1 restrained)
##  6      31.72525           1.0    169   11:49:15
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 30.85
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 169 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 31.72525
## 
## $nedf
## [1] 169
## 
## $sigma
## [1] 1
## 
## $varcomp
##            component std.error z.ratio bound %ch
## REP     1.011929e-07        NA      NA     B  NA
## units!R 1.000000e+00        NA      NA     F   0
## 
## $bic
## [1] -58.32059
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -61.45049
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 30.85084
## 
## $heterogeneity
## [1] 0.1825493
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:16
##           LogLik        Sigma2     DF     wall
##  1      31.73035           1.0    169   11:49:16
##  2      31.72525           1.0    169   11:49:16
##  3      31.72525           1.0    169   11:49:16
##  4      31.72525           1.0    169   11:49:16
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 30.85
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 169 df.
## [1] "##############################"
## [1] "### Analyzing FDK in RAL19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:16
##           LogLik        Sigma2     DF     wall
##  1     -394.6913           1.0    177   11:49:16  (  1 restrained)
##  2     -393.8418           1.0    177   11:49:16  (  1 restrained)
##  3     -394.5519           1.0    177   11:49:16
##  4     -394.1261           1.0    177   11:49:16
##  5     -393.8138           1.0    177   11:49:16
##  6     -393.6710           1.0    177   11:49:16
##  7     -393.6528           1.0    177   11:49:16
##  8     -393.6553           1.0    177   11:49:16
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 1415.37
##         : Variance heterogenity factor (Deviance/df): 8.00 assuming 177 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -393.6553
## 
## $nedf
## [1] 177
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component   std.error   z.ratio bound %ch
## REP     0.002464195 0.003662132 0.6728855     P 0.9
## units!R 1.000000000          NA        NA     F 0.0
## 
## $bic
## [1] 792.4868
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 789.3107
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 1415.368
## 
## $heterogeneity
## [1] 7.996429
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:17
##           LogLik        Sigma2     DF     wall
##  1     -393.3045           1.0    177   11:49:17
##  2     -393.6558           1.0    177   11:49:17
##  3     -393.6558           1.0    177   11:49:17
##  4     -393.6558           1.0    177   11:49:17
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 1415.37
##         : Variance heterogenity factor (Deviance/df): 8.00 assuming 177 df.
## [1] "##############################"
## [1] "### Analyzing DON in RAL19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:17
##           LogLik        Sigma2     DF     wall
##  1     -329.2665           1.0    177   11:49:17
##  2     -374.8192           1.0    177   11:49:17
##  3     -376.6420           1.0    177   11:49:17
##  4     -376.6337           1.0    177   11:49:17
##  5     -376.6270           1.0    177   11:49:17
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 1252.01
##         : Variance heterogenity factor (Deviance/df): 7.07 assuming 177 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -376.627
## 
## $nedf
## [1] 177
## 
## $sigma
## [1] 1
## 
## $varcomp
##          component  std.error   z.ratio bound %ch
## REP     0.03711523 0.05281526 0.7027369     P 0.2
## units!R 1.00000000         NA        NA     F 0.0
## 
## $bic
## [1] 758.4302
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 755.254
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 1252.009
## 
## $heterogeneity
## [1] 7.0735
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:18
##           LogLik        Sigma2     DF     wall
##  1     -329.0394           1.0    177   11:49:18
##  2     -374.7773           1.0    177   11:49:18
##  3     -376.6273           1.0    177   11:49:18
##  4     -376.6273           1.0    177   11:49:18
##  5     -376.6273           1.0    177   11:49:18
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 1252.01
##         : Variance heterogenity factor (Deviance/df): 7.07 assuming 177 df.
## [1] "#############################"
## [1] "### Analyzing PH in RAL19 ###"
## [1] "#############################"
## [1] "### PH not taken in RAL19 moving on..."
## [1] "#############################"
## [1] "### Analyzing HD in RAL20 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:18
##           LogLik        Sigma2     DF     wall
##  1     -271.9577      2.940139    201   11:49:18
##  2     -271.9528      2.939200    201   11:49:18
##  3     -271.9477      2.937255    201   11:49:18
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## ASReml Version 4.2 05/07/2024 11:49:18
##           LogLik        Sigma2     DF     wall
##  1     -271.9476      2.937007    201   11:49:18
##  2     -271.9476      2.937006    201   11:49:18
##  3     -271.9476      2.937003    201   11:49:18
## [1] "##############################"
## [1] "### Analyzing FHB in RAL20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:18
##           LogLik        Sigma2     DF     wall
##  1      24.53280           1.0    202   11:49:18  (  1 restrained)
##  2      25.76846           1.0    202   11:49:18  (  1 restrained)
##  3      26.43301           1.0    202   11:49:18  (  1 restrained)
##  4      26.52475           1.0    202   11:49:18  (  1 restrained)
##  5      26.53106           1.0    202   11:49:18  (  1 restrained)
##  6      26.53147           1.0    202   11:49:18
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 58.18
##         : Variance heterogenity factor (Deviance/df): 0.29 assuming 202 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 26.53147
## 
## $nedf
## [1] 202
## 
## $sigma
## [1] 1
## 
## $varcomp
##            component std.error z.ratio bound %ch
## REP     1.011929e-07        NA      NA     B  NA
## units!R 1.000000e+00        NA      NA     F   0
## 
## $bic
## [1] -47.75467
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -51.06294
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 58.1805
## 
## $heterogeneity
## [1] 0.2880223
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:19
##           LogLik        Sigma2     DF     wall
##  1      26.56548           1.0    202   11:49:19
##  2      26.53147           1.0    202   11:49:19
##  3      26.53147           1.0    202   11:49:19
##  4      26.53147           1.0    202   11:49:19
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 58.18
##         : Variance heterogenity factor (Deviance/df): 0.29 assuming 202 df.
## [1] "##############################"
## [1] "### Analyzing FDK in RAL20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:19
##           LogLik        Sigma2     DF     wall
##  1     -214.0270           1.0    197   11:49:19  (  1 restrained)
##  2     -214.9834           1.0    197   11:49:19
##  3     -214.9911           1.0    197   11:49:19
##  4     -214.9987           1.0    197   11:49:19
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 897.60
##         : Variance heterogenity factor (Deviance/df): 4.56 assuming 197 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -214.9987
## 
## $nedf
## [1] 197
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component  std.error   z.ratio bound %ch
## REP     0.007070315 0.01035858 0.6825567     P 0.3
## units!R 1.000000000         NA        NA     F 0.0
## 
## $bic
## [1] 435.2806
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 431.9974
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 897.603
## 
## $heterogeneity
## [1] 4.556361
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:20
##           LogLik        Sigma2     DF     wall
##  1     -213.0443           1.0    197   11:49:20
##  2     -214.9989           1.0    197   11:49:20
##  3     -214.9992           1.0    197   11:49:20
##  4     -214.9992           1.0    197   11:49:20
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 897.60
##         : Variance heterogenity factor (Deviance/df): 4.56 assuming 197 df.
## [1] "##############################"
## [1] "### Analyzing DON in RAL20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:20
##           LogLik        Sigma2     DF     wall
##  1     -29.08515           1.0     93   11:49:20  (  1 restrained)
##  2     -29.85891           1.0     93   11:49:20
##  3     -29.83334           1.0     93   11:49:20
##  4     -29.80953           1.0     93   11:49:20
##  5     -29.81208           1.0     93   11:49:20
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 99.30
##         : Variance heterogenity factor (Deviance/df): 1.07 assuming 93 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -29.81208
## 
## $nedf
## [1] 93
## 
## $sigma
## [1] 1
## 
## $varcomp
##           component  std.error   z.ratio bound %ch
## REP     0.004069305 0.01078283 0.3773876     P   0
## units!R 1.000000000         NA        NA     F   0
## 
## $bic
## [1] 64.15675
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 61.62415
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 99.29714
## 
## $heterogeneity
## [1] 1.067711
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:21
##           LogLik        Sigma2     DF     wall
##  1     -28.02039           1.0     93   11:49:21
##  2     -29.81076           1.0     93   11:49:21
##  3     -29.81165           1.0     93   11:49:21
##  4     -29.81210           1.0     93   11:49:21
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 99.30
##         : Variance heterogenity factor (Deviance/df): 1.07 assuming 93 df.
## [1] "#############################"
## [1] "### Analyzing PH in RAL20 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:21
##           LogLik        Sigma2     DF     wall
##  1     -416.1138      12.10252    202   11:49:21  (  1 restrained)
##  2     -415.6330      12.17657    202   11:49:21
##  3     -415.6051      12.15841    202   11:49:21
##  4     -415.6035      12.15375    202   11:49:21
## ASReml Version 4.2 05/07/2024 11:49:21
##           LogLik        Sigma2     DF     wall
##  1     -415.6035      12.15340    202   11:49:21
##  2     -415.6035      12.15340    202   11:49:21
##  3     -415.6035      12.15340    202   11:49:21
## [1] "#############################"
## [1] "### Analyzing HD in WAR19 ###"
## [1] "#############################"
## [1] "### HD not taken in WAR19 moving on..."
## [1] "##############################"
## [1] "### Analyzing FHB in WAR19 ###"
## [1] "##############################"
## [1] "### FHB not taken in WAR19 moving on..."
## [1] "##############################"
## [1] "### Analyzing FDK in WAR19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:21
##           LogLik        Sigma2     DF     wall
##  1     -551.8200           1.0    174   11:49:22  (  1 restrained)
##  2     -573.2883           1.0    174   11:49:22
##  3     -579.2964           1.0    174   11:49:22
##  4     -585.2846           1.0    174   11:49:22
##  5     -591.2799           1.0    174   11:49:22
##  6     -597.2778           1.0    174   11:49:22
##  7     -603.2767           1.0    174   11:49:22
##  8     -609.2762           1.0    174   11:49:22
##  9     -575.7600           1.0    174   11:49:22
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 10 12 -15.46 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 10 12 -16.46 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 11 12 -17.46 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, : Warning : Aborting GLM fit because predicted values are out of bounds
##           : Try a more reasonable link function
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Error : Errors in GLM
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Log-likelihood not converged

## ASReml Version 4.2 05/07/2024 11:49:22
##           LogLik        Sigma2     DF     wall
##  1     -627.6781      253.2274    174   11:49:22  (  1 restrained)
##  2     -627.2055      254.9961    174   11:49:22
##  3     -627.1799      254.5715    174   11:49:22
##  4     -627.1784      254.4658    174   11:49:22
## ASReml Version 4.2 05/07/2024 11:49:22
##           LogLik        Sigma2     DF     wall
##  1     -627.1784      254.4583    174   11:49:22
##  2     -627.1784      254.4583    174   11:49:22
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     G.param = fit$G.param, R.param = fit$R.param, data = pheno_subset, 
##     maxit = 75)
## 
## $loglik
## [1] -627.1784
## 
## $nedf
## [1] 174
## 
## $sigma
## [1] 15.95175
## 
## $varcomp
##          component std.error   z.ratio bound %ch
## REP       2.756883  6.037772 0.4566061     P   0
## units!R 254.458308 27.359528 9.3005371     P   0
## 
## $bic
## [1] 1264.675
## attr(,"parameters")
## [1] 2
## 
## $aic
## [1] 1258.357
## attr(,"parameters")
## [1] 2
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:23
##           LogLik        Sigma2     DF     wall
##  1     -627.1784      254.4583    174   11:49:23
##  2     -627.1784      254.4583    174   11:49:23
##  3     -627.1784      254.4583    174   11:49:23
## [1] "##############################"
## [1] "### Analyzing DON in WAR19 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:23
##           LogLik        Sigma2     DF     wall
##  1      45.73517           1.0    175   11:49:23
##  2      40.30355           1.0    175   11:49:23
##  3      40.11113           1.0    175   11:49:23
##  4      40.11346           1.0    175   11:49:23
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 139.80
##         : Variance heterogenity factor (Deviance/df): 0.80 assuming 175 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] 40.11346
## 
## $nedf
## [1] 175
## 
## $sigma
## [1] 1
## 
## $varcomp
##          component  std.error  z.ratio bound %ch
## REP     0.02672652 0.03442627 0.776341     P 7.7
## units!R 1.00000000         NA       NA     F 0.0
## 
## $bic
## [1] -75.06213
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] -78.22691
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 139.7978
## 
## $heterogeneity
## [1] 0.7988448
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels
## 
## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1      46.06474           1.0    175   11:49:24
##  2      40.32630           1.0    175   11:49:24
##  3      40.10768           1.0    175   11:49:24
##  4      40.10745           1.0    175   11:49:24
##  5      40.10745           1.0    175   11:49:24
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 139.79
##         : Variance heterogenity factor (Deviance/df): 0.80 assuming 175 df.
## [1] "#############################"
## [1] "### Analyzing PH in WAR19 ###"
## [1] "#############################"
## [1] "### PH not taken in WAR19 moving on..."
## [1] "#############################"
## [1] "### Analyzing HD in WAR20 ###"
## [1] "#############################"
## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1     -229.2203      1.719027    213   11:49:24  (  1 restrained)
##  2     -228.4299      1.724101    213   11:49:24
##  3     -228.4124      1.728254    213   11:49:24
##  4     -228.4026      1.726768    213   11:49:24
##  5     -228.4023      1.726514    213   11:49:24
## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1     -228.4023      1.726506    213   11:49:24
##  2     -228.4023      1.726506    213   11:49:24
##  3     -228.4023      1.726506    213   11:49:24
## [1] "##############################"
## [1] "### Analyzing FHB in WAR20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1     -85.18770           1.0    212   11:49:24  (  1 restrained)
##  2     -100.4930           1.0    212   11:49:24  (  1 restrained)
##  3     -116.1241           1.0    212   11:49:24
##  4     -132.1610           1.0    212   11:49:24
##  5     -148.1610           1.0    212   11:49:24
##  6     -164.1611           1.0    212   11:49:24
##  7     -180.1611           1.0    212   11:49:24
##  8     -107.8146           1.0    212   11:49:24
##  9     -107.8147           1.0    212   11:49:24
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 181.59
##         : Variance heterogenity factor (Deviance/df): 0.86 assuming 212 df.
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 8 34 -15.17 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 9 34 -16.17 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 9 34 -17.17 0 0.00
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Warning : Warning: GLM Bounds 10 34 -18.17 0 0.00
## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1     -215.0104      1.519328    212   11:49:24  (  1 restrained)
##  2     -214.2430      1.524150    212   11:49:24
##  3     -214.2280      1.526795    212   11:49:24
##  4     -214.2247      1.526013    212   11:49:24
## Warning in asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, :
## Some components changed by more than 1% on the last iteration

## ASReml Version 4.2 05/07/2024 11:49:24
##           LogLik        Sigma2     DF     wall
##  1     -214.2247      1.525930    212   11:49:24
##  2     -214.2247      1.525930    212   11:49:24
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     G.param = fit$G.param, R.param = fit$R.param, data = pheno_subset, 
##     maxit = 75)
## 
## $loglik
## [1] -214.2247
## 
## $nedf
## [1] 212
## 
## $sigma
## [1] 1.235285
## 
## $varcomp
##           component  std.error    z.ratio bound %ch
## REP     0.005279045 0.01883725  0.2802451     P   0
## units!R 1.525929805 0.14856223 10.2713171     P   0
## 
## $bic
## [1] 439.1625
## attr(,"parameters")
## [1] 2
## 
## $aic
## [1] 432.4494
## attr(,"parameters")
## [1] 2
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:25
##           LogLik        Sigma2     DF     wall
##  1     -214.2247      1.525929    212   11:49:25
##  2     -214.2247      1.525929    212   11:49:25
##  3     -214.2247      1.525929    212   11:49:25
## [1] "##############################"
## [1] "### Analyzing FDK in WAR20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:25
##           LogLik        Sigma2     DF     wall
##  1     -130.7596           1.0    207   11:49:25  (  1 restrained)
##  2     -130.1646           1.0    207   11:49:25  (  1 restrained)
##  3     -129.2463           1.0    207   11:49:25
##  4     -129.2151           1.0    207   11:49:25
##  5     -129.2211           1.0    207   11:49:25
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 741.94
##         : Variance heterogenity factor (Deviance/df): 3.58 assuming 207 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -129.2211
## 
## $nedf
## [1] 207
## 
## $sigma
## [1] 1
## 
## $varcomp
##            component    std.error   z.ratio bound %ch
## REP     0.0002927804 0.0007981389 0.3668289     P 0.3
## units!R 1.0000000000           NA        NA     F 0.0
## 
## $bic
## [1] 263.7748
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 260.4421
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 741.9373
## 
## $heterogeneity
## [1] 3.584238
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:26
##           LogLik        Sigma2     DF     wall
##  1     -128.4636           1.0    207   11:49:26
##  2     -129.2211           1.0    207   11:49:26
##  3     -129.2212           1.0    207   11:49:26
##  4     -129.2213           1.0    207   11:49:26
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 741.94
##         : Variance heterogenity factor (Deviance/df): 3.58 assuming 207 df.
## [1] "##############################"
## [1] "### Analyzing DON in WAR20 ###"
## [1] "##############################"
## ASReml Version 4.2 05/07/2024 11:49:26
##           LogLik        Sigma2     DF     wall
##  1     -17.95262           1.0    205   11:49:26  (  1 restrained)
##  2     -17.91268           1.0    205   11:49:26  (  1 restrained)
##  3     -17.44163           1.0    205   11:49:26  (  1 restrained)
##  4     -17.41066           1.0    205   11:49:26  (  1 restrained)
##  5     -17.40858           1.0    205   11:49:26  (  1 restrained)
##  6     -17.40842           1.0    205   11:49:26
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 36.32
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 205 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP, residual = ~units, 
##     family = asr_poisson(), data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -17.40842
## 
## $nedf
## [1] 205
## 
## $sigma
## [1] 1
## 
## $varcomp
##            component std.error z.ratio bound %ch
## REP     1.011929e-07        NA      NA     B  NA
## units!R 1.000000e+00        NA      NA     F   0
## 
## $bic
## [1] 40.13984
## attr(,"parameters")
## [1] 1
## 
## $aic
## [1] 36.81683
## attr(,"parameters")
## [1] 1
## 
## $deviance
## [1] 36.32193
## 
## $heterogeneity
## [1] 0.1771801
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:27
##           LogLik        Sigma2     DF     wall
##  1     -16.21597           1.0    205   11:49:27
##  2     -17.40785           1.0    205   11:49:27
##  3     -17.40842           1.0    205   11:49:27
##  4     -17.40842           1.0    205   11:49:27
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 36.32
##         : Variance heterogenity factor (Deviance/df): 0.18 assuming 205 df.
## [1] "#############################"
## [1] "### Analyzing PH in WAR20 ###"
## [1] "#############################"
## [1] "### PH not taken in WAR20 moving on..."

Multi-environmental models

# Define traits
traits <- colnames(pheno)[8:12]

# Create dataframe for predictions
BLUEs_mem <- data.frame(GENOTYPE = unique(pheno$GENOTYPE))

# Run MEMLM loop for each trait
for (i in traits) {
  
  # Print message
  print_message <- paste("### Analyzing", i, "###")
  print(paste(rep("#", nchar(print_message)), collapse = ""))
  print(print_message)
  print(paste(rep("#", nchar(print_message)), collapse = ""))
  
  # Subset data
  pheno_subset <- na.omit(pheno[, c("GENOTYPE", "YEAR", "ENV", "REP", i)])
  
  # Redefine data types
  pheno_subset[, 1:4] <- lapply(pheno_subset[, 1:4], as.factor)
  pheno_subset[, 5] <- as.numeric(pheno_subset[, 5])
  colnames(pheno_subset)[5] <- "Y"
  
  # Run mixed effects model
  if (i %in% c("FHB", "FDK", "DON")) {
    # Fit model with Poisson distribution
    fit <- asreml(fixed = Y ~ GENOTYPE,
                  random = ~ REP:ENV + GENOTYPE:ENV,
                  residual = ~ units,
                  data = pheno_subset,
                  family = asr_poisson(),
                  maxit = 75)
    
  } else {
    # Fit model with normal distribution
    fit <- asreml(fixed = Y ~ GENOTYPE,
                  random = ~ REP:ENV + GENOTYPE:ENV,
                  residual = ~ units,
                  data = pheno_subset,
                  #family = asr_poisson(),
                  maxit = 75)
      
  }
  
  # Get quick summary
  print(summary(fit))
  print(plot(fit))

  # Get predictions
  pred <- predict(fit, classify = "GENOTYPE")$pvals[, 1:2]
  colnames(pred)[2] <- paste(i, "ME", sep = "_") 
  
  # Left join predictions to main dataframe
  BLUEs_mem <- left_join(BLUEs_mem, pred, by = "GENOTYPE")
  
  # Remove temporary objects
  remove(pheno_subset, fit, pred)
}
## [1] "####################"
## [1] "### Analyzing HD ###"
## [1] "####################"
## ASReml Version 4.2 05/07/2024 11:49:34
##           LogLik        Sigma2     DF     wall
##  1     -2589.554      13.45284   1305   11:49:34
##  2     -2187.277      6.566912   1305   11:49:34
##  3     -1891.054      4.237486   1305   11:49:34
##  4     -1736.569      3.279107   1305   11:49:34
##  5     -1650.794      2.874223   1305   11:49:34
##  6     -1613.385      2.697494   1305   11:49:34
##  7     -1596.627      2.620326   1305   11:49:34
##  8     -1589.474      2.582799   1305   11:49:34
##  9     -1586.795      2.564885   1305   11:49:34
## 10     -1586.047      2.556611   1305   11:49:34
## 11     -1585.938      2.553459   1305   11:49:34
## 12     -1585.934      2.552805   1305   11:49:34
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP:ENV + GENOTYPE:ENV, 
##     residual = ~units, data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -1585.934
## 
## $nedf
## [1] 1305
## 
## $sigma
## [1] 1.59775
## 
## $varcomp
##                component   std.error  z.ratio bound %ch
## REP:ENV      212.1094295 113.0140989  1.87684     P 0.2
## GENOTYPE:ENV   0.6367875   0.1232248  5.16769     P 0.0
## units!R        2.5528045   0.1241995 20.55407     P 0.0
## 
## $bic
## [1] 3193.389
## attr(,"parameters")
## [1] 3
## 
## $aic
## [1] 3177.867
## attr(,"parameters")
## [1] 3
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:35
##           LogLik        Sigma2     DF     wall
##  1     -1585.934      2.552773   1305   11:49:35
##  2     -1585.934      2.552773   1305   11:49:35
##  3     -1585.934      2.552773   1305   11:49:35
## [1] "#####################"
## [1] "### Analyzing FHB ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:35
##           LogLik        Sigma2     DF     wall
##  1      235.7098           1.0   1599   11:49:35  (  1 restrained)
##  2      341.8815           1.0   1599   11:49:35  (  1 restrained)
##  3      342.0703           1.0   1599   11:49:35  (  1 restrained)
##  4      342.6015           1.0   1599   11:49:35  (  1 restrained)
##  5      342.5865           1.0   1599   11:49:35  (  1 restrained)
##  6      342.5875           1.0   1599   11:49:35
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 822.29
##         : Variance heterogenity factor (Deviance/df): 0.51 assuming 1599 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP:ENV + GENOTYPE:ENV, 
##     residual = ~units, family = asr_poisson(), data = pheno_subset, 
##     maxit = 75)
## 
## $loglik
## [1] 342.5875
## 
## $nedf
## [1] 1599
## 
## $sigma
## [1] 1
## 
## $varcomp
##                 component  std.error  z.ratio bound %ch
## REP:ENV      5.653994e-02 0.02751384 2.054963     P   0
## GENOTYPE:ENV 1.011929e-07         NA       NA     B  NA
## units!R      1.000000e+00         NA       NA     F   0
## 
## $bic
## [1] -670.4208
## attr(,"parameters")
## [1] 2
## 
## $aic
## [1] -681.1751
## attr(,"parameters")
## [1] 2
## 
## $deviance
## [1] 822.2872
## 
## $heterogeneity
## [1] 0.5142509
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:36
##           LogLik        Sigma2     DF     wall
##  1      342.6995           1.0   1599   11:49:36
##  2      342.5876           1.0   1599   11:49:36
##  3      342.5876           1.0   1599   11:49:36
##  4      342.5876           1.0   1599   11:49:36
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 822.29
##         : Variance heterogenity factor (Deviance/df): 0.51 assuming 1599 df.
## [1] "#####################"
## [1] "### Analyzing FDK ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:36
##           LogLik        Sigma2     DF     wall
##  1     -1422.182           1.0   1947   11:49:37
##  2     -1428.506           1.0   1947   11:49:37
##  3     -1427.713           1.0   1947   11:49:37
##  4     -1429.077           1.0   1947   11:49:37
##  5     -1430.580           1.0   1947   11:49:37
##  6     -1431.569           1.0   1947   11:49:37
##  7     -1432.232           1.0   1947   11:49:37
##  8     -1432.680           1.0   1947   11:49:37
##  9     -1433.522           1.0   1947   11:49:37
## 10     -1433.561           1.0   1947   11:49:37
## 11     -1433.600           1.0   1947   11:49:37
## 12     -1433.602           1.0   1947   11:49:37
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 6741.13
##         : Variance heterogenity factor (Deviance/df): 3.46 assuming 1947 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP:ENV + GENOTYPE:ENV, 
##     residual = ~units, family = asr_poisson(), data = pheno_subset, 
##     maxit = 75)
## 
## $loglik
## [1] -1433.602
## 
## $nedf
## [1] 1947
## 
## $sigma
## [1] 1
## 
## $varcomp
##              component   std.error   z.ratio bound %ch
## REP:ENV      0.1091502 0.047187540  2.313116     P   0
## GENOTYPE:ENV 0.1470754 0.008583812 17.134038     P   0
## units!R      1.0000000          NA        NA     F   0
## 
## $bic
## [1] 2882.353
## attr(,"parameters")
## [1] 2
## 
## $aic
## [1] 2871.205
## attr(,"parameters")
## [1] 2
## 
## $deviance
## [1] 6741.135
## 
## $heterogeneity
## [1] 3.462319
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:38
##           LogLik        Sigma2     DF     wall
##  1     -1421.484           1.0   1947   11:49:38
##  2     -1433.587           1.0   1947   11:49:38
##  3     -1433.595           1.0   1947   11:49:38
##  4     -1433.602           1.0   1947   11:49:38
##  5     -1433.602           1.0   1947   11:49:38
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 6741.13
##         : Variance heterogenity factor (Deviance/df): 3.46 assuming 1947 df.
## [1] "#####################"
## [1] "### Analyzing DON ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:38
##           LogLik        Sigma2     DF     wall
##  1     -289.2838           1.0   1790   11:49:38
##  2     -284.0212           1.0   1790   11:49:38
##  3     -329.5288           1.0   1790   11:49:38
##  4     -353.0202           1.0   1790   11:49:38
##  5     -351.9304           1.0   1790   11:49:38
##  6     -350.6739           1.0   1790   11:49:38
##  7     -350.3405           1.0   1790   11:49:38
##  8     -350.3911           1.0   1790   11:49:38
##  9     -350.4227           1.0   1790   11:49:38
## 10     -350.4238           1.0   1790   11:49:38
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 2681.43
##         : Variance heterogenity factor (Deviance/df): 1.50 assuming 1790 df.
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP:ENV + GENOTYPE:ENV, 
##     residual = ~units, family = asr_poisson(), data = pheno_subset, 
##     maxit = 75)
## 
## $loglik
## [1] -350.4238
## 
## $nedf
## [1] 1790
## 
## $sigma
## [1] 1
## 
## $varcomp
##               component   std.error   z.ratio bound %ch
## REP:ENV      0.63966663 0.273794319  2.336303     P   0
## GENOTYPE:ENV 0.08798913 0.007822804 11.247773     P   0
## units!R      1.00000000          NA        NA     F   0
## 
## $bic
## [1] 715.8275
## attr(,"parameters")
## [1] 2
## 
## $aic
## [1] 704.8475
## attr(,"parameters")
## [1] 2
## 
## $deviance
## [1] 2681.432
## 
## $heterogeneity
## [1] 1.498007
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:39
##           LogLik        Sigma2     DF     wall
##  1     -278.0900           1.0   1790   11:49:39
##  2     -272.9965           1.0   1790   11:49:39
##  3     -326.0900           1.0   1790   11:49:39
##  4     -350.7465           1.0   1790   11:49:39
##  5     -350.8672           1.0   1790   11:49:39
##  6     -350.5430           1.0   1790   11:49:39
##  7     -350.4159           1.0   1790   11:49:40
##  8     -350.4242           1.0   1790   11:49:40
##  9     -350.4237           1.0   1790   11:49:40
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 2681.43
##         : Variance heterogenity factor (Deviance/df): 1.50 assuming 1790 df.
## [1] "####################"
## [1] "### Analyzing PH ###"
## [1] "####################"
## ASReml Version 4.2 05/07/2024 11:49:40
##           LogLik        Sigma2     DF     wall
##  1     -1211.680      14.08651    586   11:49:40
##  2     -1210.549      13.74732    586   11:49:40
##  3     -1209.640      13.33277    586   11:49:40
##  4     -1209.358      12.98586    586   11:49:40
##  5     -1209.357      12.96550    586   11:49:40
## $call
## asreml(fixed = Y ~ GENOTYPE, random = ~REP:ENV + GENOTYPE:ENV, 
##     residual = ~units, data = pheno_subset, maxit = 75)
## 
## $loglik
## [1] -1209.357
## 
## $nedf
## [1] 586
## 
## $sigma
## [1] 3.600764
## 
## $varcomp
##              component std.error   z.ratio bound %ch
## REP:ENV       1.476929 1.2864625  1.148054     P 0.1
## GENOTYPE:ENV  3.488914 1.1138624  3.132267     P 0.0
## units!R      12.965500 0.8947512 14.490620     P 0.0
## 
## $bic
## [1] 2437.834
## attr(,"parameters")
## [1] 3
## 
## $aic
## [1] 2424.714
## attr(,"parameters")
## [1] 3
## 
## attr(,"class")
## [1] "summary.asreml"

## $histogram

## 
## $qq

## 
## $fitted

## 
## $rowlabels

## 
## ASReml Version 4.2 05/07/2024 11:49:41
##           LogLik        Sigma2     DF     wall
##  1     -1209.357      12.96567    586   11:49:41
##  2     -1209.357      12.96567    586   11:49:41
##  3     -1209.357      12.96567    586   11:49:41
# Select specific traits from the results
BLUEs_mem <- BLUEs_mem %>%
  select(GENOTYPE, FHB_ME, FDK_ME, DON_ME, HD_ME, PH_ME)

Heritabilities

# Make an empty data frame for the heritability estimates
h2s <- data.frame(Trait = character(), 
                  Type = character(), 
                  Estimation = numeric(), 
                  SE = numeric())

# Calculate the harmonic means for each trait
e_traits <- list()
r_traits <- list()

for (j in traits) {
  # Subset data and only take complete case
  a <- pheno %>% 
    drop_na(all_of(j))
  
  # Get the number of observations per genotype
  obs_per_ind <- aggregate(a[, j] ~ GENOTYPE, 
                           data = a,
                           length)
  
  # Calculate the harmonic mean of replications
  r <- (1 / mean(1 / obs_per_ind$`a[, j]`))
  
  # Put that in an object
  r_traits[j] <- r
  
  # Create a new object called e
  e <- c()
  
  # For every genotype in the phenotypic dataset 
  for (i in unique(pheno$GENOTYPE)) {
    # Get every observation in every environment
    a <- na.omit(pheno[pheno$GENOTYPE == i, c("ENV", j)])
    
    # Get get the number of environments that the genotype was observed in
    a <- length(unique(a$ENV))
    
    # If the number of environments equals 0, then 0, if it is greater than that, do 1 / number of environments
    a <- ifelse(a == 0, 0, 1 / a)
    
    # Add this value to the vector e
    e <- rbind(e, a)
  }
  
  # Take the reciprocal of the value e to get the harmonic mean of environments
  e_traits[j] <- (1 / mean(e)) 
  
  # Remove all the little things
  remove(a, obs_per_ind, r, e)
}

# Loop through each trait for heritability estimation
for (i in traits) {
  # Print message
  print_message <- paste("### Analyzing", i, "###")
  print(paste(rep("#", nchar(print_message)), collapse = ""))
  print(print_message)
  print(paste(rep("#", nchar(print_message)), collapse = ""))
  
  # Determine number of locations
  n_loc <- pheno %>% 
    select(ENV, YEAR, LOC, all_of(i)) %>% 
    drop_na() %>% 
    distinct(ENV)
  n_loc <- as.numeric(nrow(n_loc))
  
  # Determine the number of replications
  n_rep <- n_loc * 2
  
  # Determin the number of years
  n_year <- pheno %>% 
    select(ENV, YEAR, LOC, all_of(i)) %>% 
    drop_na() %>% 
    distinct(YEAR)
  n_year <- as.numeric(count(n_year))
  
  # Get the harmonic mean of environments
  e <- as.numeric(e_traits[i])
  
  # Get the harmonic mean of replications
  r <- as.numeric(r_traits[i])
  
  # If the trait has been observed over many years
  if (n_year >= 2) {
    # If the trait is a disease reaction trait
    if (i %in% c("FHB", "FDK", "DON")) {
      # Run model for Poisson distributed traits
      mlm <- asreml(fixed = pheno[, i] ~ 1,
                    random = ~ GENOTYPE +
                      ENV +
                      GENOTYPE:ENV,
                    residual = ~ idv(units),
                    data = pheno,
                    maxit = 75,
                    family = asr_poisson())
    } else {
      # Run model for normally distributed traits
      mlm <- asreml(fixed = pheno[, i] ~ 1,
                    random = ~ (GENOTYPE) +
                      ENV +
                      GENOTYPE:ENV,
                    residual = ~ idv(units),
                    data = pheno,
                    maxit = 75)
    }
  # If the trait has been only observed in one year
  } else {
    # Run model for single year data
    mlm <- asreml(fixed = pheno[, i] ~ 1,
                  random = ~ (GENOTYPE) +
                    ENV +
                    GENOTYPE:ENV,
                  residual = ~ idv(units),
                  data = pheno,
                  maxit = 75)
  }
  
  # Print summary of variance components
  print(summary(mlm)$varcomp)
  
  # Predict heritability estimates
  pph2 <- vpredict(mlm, 
                   h2 ~ V2 / (V2 + V3 + V4))
  
  emh2 <- vpredict(mlm,
                   h2 ~ V2 / (V2 + (V3 / e) + (V4 / (e * r))))
  
  # Bind predictions to h2s data frame
  a <- rbind(pph2, emh2)
  a <- cbind(data.frame(Trait = c(i, i)), data.frame(Type = c("Per-Plot", "Entry-Mean")), a)
  h2s <- rbind(h2s, a)
  
  # Remove the little things
  remove(mlm, pph2, emh2, n_loc, n_rep, n_year, e, r, a)
}
## [1] "####################"
## [1] "### Analyzing HD ###"
## [1] "####################"
## ASReml Version 4.2 05/07/2024 11:49:44
##           LogLik        Sigma2     DF     wall
##  1     -2405.247           1.0   1480   11:49:44  (  1 restrained)
##  2     -2348.740           1.0   1480   11:49:44
##  3     -2066.589           1.0   1480   11:49:44
##  4     -1834.873           1.0   1480   11:49:44
##  5     -1806.601           1.0   1480   11:49:44
##  6     -1798.658           1.0   1480   11:49:44
##  7     -1794.992           1.0   1480   11:49:44
##  8     -1793.582           1.0   1480   11:49:44
##  9     -1793.153           1.0   1480   11:49:44
## 10     -1793.078           1.0   1480   11:49:44
## 11     -1793.074           1.0   1480   11:49:44
## Warning in asreml(fixed = pheno[, i] ~ 1, random = ~(GENOTYPE) + ENV +
## GENOTYPE:ENV, : Warning : Log-likelihood decreased to -2713.75; trying with
## reduced updates 0.936318
##                component   std.error   z.ratio bound %ch
## ENV          247.4503074 200.5523769  1.233844     P 0.5
## GENOTYPE       3.4636787   0.4237671  8.173543     P 0.0
## GENOTYPE:ENV   0.6107864   0.1235586  4.943295     P 0.0
## units!units    2.6341461   0.1273212 20.688983     P 0.0
## units!R        1.0000000          NA        NA     F 0.0
## [1] "#####################"
## [1] "### Analyzing FHB ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:44
##           LogLik        Sigma2     DF     wall
##  1      326.3373           1.0   1773   11:49:44
##  2      446.0406           1.0   1773   11:49:44
##  3      574.2352           1.0   1773   11:49:44
##  4      644.9267           1.0   1773   11:49:44
##  5      667.3598           1.0   1773   11:49:44
##  6      667.7294           1.0   1773   11:49:44
##  7      667.7791           1.0   1773   11:49:44
##  8      667.7792           1.0   1773   11:49:44
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 657.12
##         : Variance heterogenity factor (Deviance/df): 0.37 assuming 1773 df.
##               component   std.error   z.ratio bound %ch
## ENV          0.07142689 0.050885047  1.403691     P   0
## GENOTYPE     0.09048161 0.011620599  7.786312     P   0
## GENOTYPE:ENV 0.02267221 0.005020015  4.516362     P   0
## units!units  0.38850437 0.017654202 22.006341     P   0
## units!R      1.00000000          NA        NA     F   0
## [1] "#####################"
## [1] "### Analyzing FDK ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:44
##           LogLik        Sigma2     DF     wall
##  1     -275.6635           1.0   2121   11:49:44  (  1 restrained)
##  2     -1340.498           1.0   2121   11:49:44
##  3     -792.0497           1.0   2121   11:49:44
##  4     -200.8308           1.0   2121   11:49:44
##  5      141.1055           1.0   2121   11:49:44
##  6      268.4041           1.0   2121   11:49:44
##  7      283.0714           1.0   2121   11:49:44
##  8      283.3257           1.0   2121   11:49:44
##  9      283.2893           1.0   2121   11:49:44
## 10      283.2885           1.0   2121   11:49:44
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 10288.48
##         : Variance heterogenity factor (Deviance/df): 4.85 assuming 2121 df.
##               component   std.error   z.ratio bound %ch
## ENV          0.10982711 0.070001196  1.568932     P   0
## GENOTYPE     0.13666405 0.017265438  7.915470     P   0
## GENOTYPE:ENV 0.03682012 0.007001431  5.258942     P   0
## units!units  5.32960798 0.217433176 24.511476     P   0
## units!R      1.00000000          NA        NA     F   0
## [1] "#####################"
## [1] "### Analyzing DON ###"
## [1] "#####################"
## ASReml Version 4.2 05/07/2024 11:49:44
##           LogLik        Sigma2     DF     wall
##  1     -651.6594           1.0   1964   11:49:44  (  1 restrained)
##  2     -1064.670           1.0   1964   11:49:44
##  3     -815.7820           1.0   1964   11:49:44
##  4     -454.3617           1.0   1964   11:49:44
##  5     -254.4660           1.0   1964   11:49:44
##  6     -187.1139           1.0   1964   11:49:44
##  7     -181.8392           1.0   1964   11:49:44
##  8     -181.7502           1.0   1964   11:49:44
##  9     -181.7521           1.0   1964   11:49:44
## Notice  : Distribution and link: Poisson; Log   Mu=exp(XB) V=Mu
## Notice  : The LogL value is unsuitable for comparing GLM models
## Notice  : Deviance from GLM fit: 3421.58
##         : Variance heterogenity factor (Deviance/df): 1.74 assuming 1964 df.
##               component   std.error   z.ratio bound %ch
## ENV          0.71456770 0.453102633  1.577055     P   0
## GENOTYPE     0.21816468 0.027280611  7.997060     P   0
## GENOTYPE:ENV 0.05330835 0.008306883  6.417371     P   0
## units!units  2.00383964 0.079312497 25.265119     P   0
## units!R      1.00000000          NA        NA     F   0
## [1] "####################"
## [1] "### Analyzing PH ###"
## [1] "####################"
## ASReml Version 4.2 05/07/2024 11:49:44
##           LogLik        Sigma2     DF     wall
##  1     -2712.686           1.0    758   11:49:45
##  2     -2359.612           1.0    758   11:49:45
##  3     -1980.620           1.0    758   11:49:45
##  4     -1735.077           1.0    758   11:49:45
##  5     -1621.030           1.0    758   11:49:45
##  6     -1597.801           1.0    758   11:49:45
##  7     -1595.828           1.0    758   11:49:45
##  8     -1595.795           1.0    758   11:49:45
##  9     -1595.795           1.0    758   11:49:45
##              component std.error    z.ratio bound %ch
## ENV           2.231889 3.2369574  0.6895022     P   0
## GENOTYPE     27.283118 3.5190437  7.7529922     P   0
## GENOTYPE:ENV  3.444573 1.1154276  3.0881190     P   0
## units!units  13.065242 0.8994521 14.5257788     P   0
## units!R       1.000000        NA         NA     F   0

Make the rQTL file

# Read in genetic information from VCF file
geno <- read.vcf("NC13-20076xGA06493-13LE6_filt.vcf.gz", convert.chr = FALSE)
## ped stats and snps stats have been set. 
## 'p' has been set. 
## 'mu' and 'sigma' have been set.
# Convert genotype matrix to format suitable for rqtl
geno <- format_qtlmap_geno(geno, 
                            par_a = "13955-GA06493-13LE6",
                            par_b = "13955-NC13-20076",
                            rm_het = TRUE, 
                            rm_miss = TRUE, 
                            include_pars = TRUE, 
                            out_fmt = "rqtl")$abh

# Replace heterozygous calls with missing data
geno <- replace(geno, geno == "H", "-")

# Manipulate the genetic file to match rqtl's format requirements
geno <- as.data.frame(t(geno))
colnames(geno) <- geno[1, ]
geno <- geno[-1, ]
geno <- cbind(substr(gsub("[.]", "-", rownames(geno)), start = 2, stop = nchar(rownames(geno))), geno)
rownames(geno) <- NULL
geno <- rownames_to_column(geno, var = "dummy")  # Create a dummy column to sort later on
geno$dummy <- as.numeric(geno$dummy)
colnames(geno)[2] <- "GENOTYPE"
geno[1:2, 2] <- ""

# Merge all the BLUEs
BLUEs_all <- left_join(BLUEs_mem, BLUEs_loc, by = "GENOTYPE")

# Merge the phenotype and genotype files
insertme <- full_join(BLUEs_all, geno, by = "GENOTYPE")
insertme <- insertme[order(insertme$dummy), ]  # Order by dummy
insertme <- insertme[1, ]
pheno_geno <- left_join(BLUEs_all, geno, by = "GENOTYPE")
pheno_geno <- rbind(insertme, pheno_geno)
pheno_geno <- pheno_geno[order(pheno_geno$dummy), ]  # Order by dummy
pheno_geno <- pheno_geno %>% filter(!is.na(dummy))  # Get rid of any genotype that is not present
pheno_geno[1, (1:30)] <- ""  # Replace any NAs with blank data
dropme <- c("13955-AGS-2026", "13955-JAMESTOWN", "13955-NCAG11", "13955-NC13-20076", "13955-GA06493-13LE6")
pheno_geno <- pheno_geno[!(pheno_geno$GENOTYPE %in% dropme), ]
pheno_geno <- pheno_geno %>%
  select(-dummy)
colnames(pheno_geno) <- gsub("FHB", "VR", colnames(pheno_geno))

# Write out rqtl input file
write.csv(pheno_geno,
          "rqtl_input_file.csv",
          row.names = FALSE)

Make a pairs plot of traits

# Create temp 
pairs_plot_dat<-BLUEs_mem

# Rename columns for the pairs plot
colnames(pairs_plot_dat) <- c("Genotype",
                              "Visual Rating (1-9)",
                              "Fusarium Damaged Kernels (%)",
                              "Deoxynivalenol Content (PPM)",
                              "Heading Date (Days)",
                              "Plant Height (cm)")

# Visualize first
pairs.panels(pairs_plot_dat[,2:ncol(pairs_plot_dat)],
             hist.col = "gray",
             lm = TRUE,
             stars = TRUE,
             digits = 2,
             density = FALSE,
             ellipses = FALSE)

# Set up JPEG file
jpeg(filename = "pairs_plot.jpg",
     width = 9,
     height = 9,
     units = "in",
     res = 320)

# Create pairs plot
pairs.panels(pairs_plot_dat[,2:ncol(pairs_plot_dat)],
             hist.col = "gray",
             lm = TRUE,
             stars = TRUE,
             digits = 2,
             density = FALSE,
             ellipses = FALSE)

# Save and close JPEG file
dev.off()
## png 
##   2

Build Linkage Map

# Read in file
cross_file <- read.cross("csv", 
                         file = "rqtl_input_file.csv",
                         genotypes = c("A", "B", "-"), 
                         alleles = c("A", "B"), 
                         crosstype = "dh")
##  --Read the following data:
##   166  individuals
##   2954  markers
##   29  phenotypes
## Warning in summary.cross(cross): Some chromosomes > 1000 cM in length; there may be a problem with the genetic map.
##   (Perhaps it is in basepairs?)
##  --Cross type: dh
# Remove markers with low P-value from a file
toss_me <- read.table("markers_to_remove.txt")[, 1]
gt <- geno.table(cross_file)
toss_me <- unique(c(toss_me, rownames(gt[gt$P.value < 0.0001, ])))
cross_file <- drop.markers(cross_file, toss_me)

# Remove unnecessary objects
remove(gt, toss_me)

# Chromosome names
chromosomes <- c(paste0("1", LETTERS[c(1,2,4)]),
                 paste0("2", LETTERS[c(1,2,4)]),
                 paste0("3", LETTERS[c(1,2,4)]),
                 paste0("4", LETTERS[c(1,2,4)]),
                 paste0("5", LETTERS[c(1,2,4)]),
                 paste0("6", LETTERS[c(1,2,4)]),
                 paste0("7", LETTERS[c(1,2,4)]))

# Create genetic map with cM instead of BP
cross_file <- mstmap(cross_file,
                     pop.type = "dh",
                     id = "GENOTYPE",
                     chr = chromosomes,
                     anchor = TRUE,
                     detectBadData = TRUE,
                     bychr = TRUE,
                     miss.thresh = 0.15,
                     mvest.bc = FALSE)
## caution! marker: S1A_15034885 was killed due to too many missing genotype calls
## caution! marker: S1A_15345816 was killed due to too many missing genotype calls
## caution! marker: S1A_16022986 was killed due to too many missing genotype calls
## caution! marker: S1A_275765978 was killed due to too many missing genotype calls
## caution! marker: S1A_294513533 was killed due to too many missing genotype calls
## caution! marker: S1A_294735020 was killed due to too many missing genotype calls
## caution! marker: S1A_297381169 was killed due to too many missing genotype calls
## caution! marker: S1A_3618173 was killed due to too many missing genotype calls
## caution! marker: S1A_37507495 was killed due to too many missing genotype calls
## caution! marker: S1A_42151448 was killed due to too many missing genotype calls
## caution! marker: S1A_46222311 was killed due to too many missing genotype calls
## caution! marker: S1A_48769407 was killed due to too many missing genotype calls
## caution! marker: S1A_48786251 was killed due to too many missing genotype calls
## caution! marker: S1A_49245446 was killed due to too many missing genotype calls
## caution! marker: S1A_497499071 was killed due to too many missing genotype calls
## caution! marker: S1A_498539597 was killed due to too many missing genotype calls
## caution! marker: S1A_499808950 was killed due to too many missing genotype calls
## caution! marker: S1A_499864420 was killed due to too many missing genotype calls
## caution! marker: S1A_509676136 was killed due to too many missing genotype calls
## caution! marker: S1A_509676242 was killed due to too many missing genotype calls
## caution! marker: S1A_510292911 was killed due to too many missing genotype calls
## caution! marker: S1A_510983454 was killed due to too many missing genotype calls
## caution! marker: S1A_511486283 was killed due to too many missing genotype calls
## caution! marker: S1A_511633074 was killed due to too many missing genotype calls
## caution! marker: S1A_513896120 was killed due to too many missing genotype calls
## caution! marker: S1A_516064856 was killed due to too many missing genotype calls
## caution! marker: S1A_519799657 was killed due to too many missing genotype calls
## caution! marker: S1A_531610222 was killed due to too many missing genotype calls
## caution! marker: S1A_531924600 was killed due to too many missing genotype calls
## caution! marker: S1A_532489535 was killed due to too many missing genotype calls
## caution! marker: S1A_534272127 was killed due to too many missing genotype calls
## caution! marker: S1A_535408302 was killed due to too many missing genotype calls
## caution! marker: S1A_535858090 was killed due to too many missing genotype calls
## caution! marker: S1A_535882220 was killed due to too many missing genotype calls
## caution! marker: S1A_540716970 was killed due to too many missing genotype calls
## caution! marker: S1A_541320369 was killed due to too many missing genotype calls
## caution! marker: S1A_541992725 was killed due to too many missing genotype calls
## caution! marker: S1A_543386586 was killed due to too many missing genotype calls
## caution! marker: S1A_547004982 was killed due to too many missing genotype calls
## caution! marker: S1A_581203166 was killed due to too many missing genotype calls
## caution! marker: S1A_7214024 was killed due to too many missing genotype calls
## caution! marker: S1A_8704388 was killed due to too many missing genotype calls
## caution! marker: S1A_9236518 was killed due to too many missing genotype calls
## caution! marker: S1A_9954029 was killed due to too many missing genotype calls
## Number of linkage groups: 3
## The size of the linkage groups are: 89   11  1   
## The number of bins in each linkage group: 47 7   1   
## caution! marker: S1B_15099360 was killed due to too many missing genotype calls
## caution! marker: S1B_333781271 was killed due to too many missing genotype calls
## caution! marker: S1B_340462171 was killed due to too many missing genotype calls
## caution! marker: S1B_340462230 was killed due to too many missing genotype calls
## caution! marker: S1B_491229424 was killed due to too many missing genotype calls
## caution! marker: S1B_505061917 was killed due to too many missing genotype calls
## caution! marker: S1B_555776982 was killed due to too many missing genotype calls
## caution! marker: S1B_556986919 was killed due to too many missing genotype calls
## caution! marker: S1B_562303166 was killed due to too many missing genotype calls
## caution! marker: S1B_564637532 was killed due to too many missing genotype calls
## caution! marker: S1B_564859110 was killed due to too many missing genotype calls
## caution! marker: S1B_577038108 was killed due to too many missing genotype calls
## caution! marker: S1B_581199980 was killed due to too many missing genotype calls
## caution! marker: S1B_582108393 was killed due to too many missing genotype calls
## caution! marker: S1B_583759748 was killed due to too many missing genotype calls
## caution! marker: S1B_5867248 was killed due to too many missing genotype calls
## caution! marker: S1B_598697932 was killed due to too many missing genotype calls
## caution! marker: S1B_601415609 was killed due to too many missing genotype calls
## caution! marker: S1B_621266693 was killed due to too many missing genotype calls
## caution! marker: S1B_630654556 was killed due to too many missing genotype calls
## caution! marker: S1B_630930383 was killed due to too many missing genotype calls
## caution! marker: S1B_637594410 was killed due to too many missing genotype calls
## caution! marker: S1B_640613228 was killed due to too many missing genotype calls
## caution! marker: S1B_643177495 was killed due to too many missing genotype calls
## caution! marker: S1B_645623521 was killed due to too many missing genotype calls
## caution! marker: S1B_649186897 was killed due to too many missing genotype calls
## caution! marker: S1B_6576639 was killed due to too many missing genotype calls
## caution! marker: S1B_662202259 was killed due to too many missing genotype calls
## caution! marker: S1B_671563195 was killed due to too many missing genotype calls
## caution! marker: S1B_672364315 was killed due to too many missing genotype calls
## caution! marker: S1B_673593968 was killed due to too many missing genotype calls
## caution! marker: S1B_673889393 was killed due to too many missing genotype calls
## caution! marker: S1B_679383883 was killed due to too many missing genotype calls
## caution! marker: S1B_681834051 was killed due to too many missing genotype calls
## caution! marker: S1B_683415189 was killed due to too many missing genotype calls
## caution! marker: S1B_683589393 was killed due to too many missing genotype calls
## caution! marker: S1B_686876645 was killed due to too many missing genotype calls
## caution! marker: S1B_687334531 was killed due to too many missing genotype calls
## caution! marker: S1B_687536156 was killed due to too many missing genotype calls
## caution! marker: S1B_687785710 was killed due to too many missing genotype calls
## Number of linkage groups: 2
## The size of the linkage groups are: 126  1   
## The number of bins in each linkage group: 65 1   
## caution! marker: S1D_108800874 was killed due to too many missing genotype calls
## caution! marker: S1D_12336853 was killed due to too many missing genotype calls
## caution! marker: S1D_126207663 was killed due to too many missing genotype calls
## caution! marker: S1D_18994718 was killed due to too many missing genotype calls
## caution! marker: S1D_195188775 was killed due to too many missing genotype calls
## caution! marker: S1D_20898473 was killed due to too many missing genotype calls
## caution! marker: S1D_30511606 was killed due to too many missing genotype calls
## caution! marker: S1D_314114216 was killed due to too many missing genotype calls
## caution! marker: S1D_31421492 was killed due to too many missing genotype calls
## caution! marker: S1D_415213577 was killed due to too many missing genotype calls
## caution! marker: S1D_415998037 was killed due to too many missing genotype calls
## caution! marker: S1D_416307975 was killed due to too many missing genotype calls
## caution! marker: S1D_418296747 was killed due to too many missing genotype calls
## caution! marker: S1D_42037618 was killed due to too many missing genotype calls
## caution! marker: S1D_420647502 was killed due to too many missing genotype calls
## caution! marker: S1D_420713054 was killed due to too many missing genotype calls
## caution! marker: S1D_434275732 was killed due to too many missing genotype calls
## caution! marker: S1D_434283648 was killed due to too many missing genotype calls
## caution! marker: S1D_436084543 was killed due to too many missing genotype calls
## caution! marker: S1D_45693844 was killed due to too many missing genotype calls
## caution! marker: S1D_55414084 was killed due to too many missing genotype calls
## caution! marker: S1D_8128584 was killed due to too many missing genotype calls
## caution! marker: S1D_99546052 was killed due to too many missing genotype calls
## Number of linkage groups: 7
## The size of the linkage groups are: 47   1   1   1   3   1   1   
## The number of bins in each linkage group: 28 1   1   1   1   1   1   
## caution! marker: S2A_13813846 was killed due to too many missing genotype calls
## caution! marker: S2A_14934024 was killed due to too many missing genotype calls
## caution! marker: S2A_31647170 was killed due to too many missing genotype calls
## caution! marker: S2A_3600808 was killed due to too many missing genotype calls
## caution! marker: S2A_38307973 was killed due to too many missing genotype calls
## caution! marker: S2A_44183357 was killed due to too many missing genotype calls
## caution! marker: S2A_45189484 was killed due to too many missing genotype calls
## caution! marker: S2A_48253236 was killed due to too many missing genotype calls
## caution! marker: S2A_58353805 was killed due to too many missing genotype calls
## caution! marker: S2A_58361862 was killed due to too many missing genotype calls
## caution! marker: S2A_59565903 was killed due to too many missing genotype calls
## caution! marker: S2A_60773513 was killed due to too many missing genotype calls
## caution! marker: S2A_692937811 was killed due to too many missing genotype calls
## caution! marker: S2A_696221512 was killed due to too many missing genotype calls
## caution! marker: S2A_696243418 was killed due to too many missing genotype calls
## caution! marker: S2A_700349740 was killed due to too many missing genotype calls
## caution! marker: S2A_703111105 was killed due to too many missing genotype calls
## caution! marker: S2A_703391992 was killed due to too many missing genotype calls
## caution! marker: S2A_705524350 was killed due to too many missing genotype calls
## caution! marker: S2A_705790851 was killed due to too many missing genotype calls
## caution! marker: S2A_706756678 was killed due to too many missing genotype calls
## caution! marker: S2A_708156051 was killed due to too many missing genotype calls
## caution! marker: S2A_711956900 was killed due to too many missing genotype calls
## caution! marker: S2A_712313909 was killed due to too many missing genotype calls
## caution! marker: S2A_712846295 was killed due to too many missing genotype calls
## caution! marker: S2A_713127471 was killed due to too many missing genotype calls
## caution! marker: S2A_716544664 was killed due to too many missing genotype calls
## caution! marker: S2A_716906727 was killed due to too many missing genotype calls
## caution! marker: S2A_717819140 was killed due to too many missing genotype calls
## caution! marker: S2A_717940571 was killed due to too many missing genotype calls
## caution! marker: S2A_726224355 was killed due to too many missing genotype calls
## caution! marker: S2A_726296233 was killed due to too many missing genotype calls
## caution! marker: S2A_727245830 was killed due to too many missing genotype calls
## caution! marker: S2A_727951622 was killed due to too many missing genotype calls
## caution! marker: S2A_734275042 was killed due to too many missing genotype calls
## caution! marker: S2A_735244212 was killed due to too many missing genotype calls
## caution! marker: S2A_735701887 was killed due to too many missing genotype calls
## caution! marker: S2A_741832734 was killed due to too many missing genotype calls
## caution! marker: S2A_744725037 was killed due to too many missing genotype calls
## caution! marker: S2A_746797078 was killed due to too many missing genotype calls
## caution! marker: S2A_746845489 was killed due to too many missing genotype calls
## caution! marker: S2A_746935263 was killed due to too many missing genotype calls
## caution! marker: S2A_747676101 was killed due to too many missing genotype calls
## caution! marker: S2A_747676114 was killed due to too many missing genotype calls
## caution! marker: S2A_748503325 was killed due to too many missing genotype calls
## caution! marker: S2A_749902351 was killed due to too many missing genotype calls
## caution! marker: S2A_750550946 was killed due to too many missing genotype calls
## caution! marker: S2A_751661937 was killed due to too many missing genotype calls
## caution! marker: S2A_753268026 was killed due to too many missing genotype calls
## caution! marker: S2A_755740567 was killed due to too many missing genotype calls
## caution! marker: S2A_756804097 was killed due to too many missing genotype calls
## caution! marker: S2A_756928829 was killed due to too many missing genotype calls
## caution! marker: S2A_757940294 was killed due to too many missing genotype calls
## caution! marker: S2A_766701909 was killed due to too many missing genotype calls
## caution! marker: S2A_770713932 was killed due to too many missing genotype calls
## caution! marker: S2A_770977178 was killed due to too many missing genotype calls
## caution! marker: S2A_771714906 was killed due to too many missing genotype calls
## caution! marker: S2A_775552468 was killed due to too many missing genotype calls
## caution! marker: S2A_776552295 was killed due to too many missing genotype calls
## caution! marker: S2A_779809062 was killed due to too many missing genotype calls
## Number of linkage groups: 5
## The size of the linkage groups are: 116  1   1   1   1   
## The number of bins in each linkage group: 63 1   1   1   1   
## caution! marker: S2B_103905079 was killed due to too many missing genotype calls
## caution! marker: S2B_133690086 was killed due to too many missing genotype calls
## caution! marker: S2B_134703911 was killed due to too many missing genotype calls
## caution! marker: S2B_135693135 was killed due to too many missing genotype calls
## caution! marker: S2B_2114958 was killed due to too many missing genotype calls
## caution! marker: S2B_2364389 was killed due to too many missing genotype calls
## caution! marker: S2B_24136080 was killed due to too many missing genotype calls
## caution! marker: S2B_24907146 was killed due to too many missing genotype calls
## caution! marker: S2B_30465929 was killed due to too many missing genotype calls
## caution! marker: S2B_337083120 was killed due to too many missing genotype calls
## caution! marker: S2B_453631494 was killed due to too many missing genotype calls
## caution! marker: S2B_53429994 was killed due to too many missing genotype calls
## caution! marker: S2B_5666663 was killed due to too many missing genotype calls
## caution! marker: S2B_5782077 was killed due to too many missing genotype calls
## caution! marker: S2B_6264495 was killed due to too many missing genotype calls
## caution! marker: S2B_682939246 was killed due to too many missing genotype calls
## caution! marker: S2B_699695695 was killed due to too many missing genotype calls
## caution! marker: S2B_700740206 was killed due to too many missing genotype calls
## caution! marker: S2B_70804943 was killed due to too many missing genotype calls
## caution! marker: S2B_712959062 was killed due to too many missing genotype calls
## caution! marker: S2B_713939527 was killed due to too many missing genotype calls
## caution! marker: S2B_732224700 was killed due to too many missing genotype calls
## caution! marker: S2B_732342448 was killed due to too many missing genotype calls
## caution! marker: S2B_734266688 was killed due to too many missing genotype calls
## caution! marker: S2B_74837898 was killed due to too many missing genotype calls
## caution! marker: S2B_754667674 was killed due to too many missing genotype calls
## caution! marker: S2B_763506478 was killed due to too many missing genotype calls
## caution! marker: S2B_764073725 was killed due to too many missing genotype calls
## caution! marker: S2B_767121964 was killed due to too many missing genotype calls
## caution! marker: S2B_768025567 was killed due to too many missing genotype calls
## caution! marker: S2B_773465908 was killed due to too many missing genotype calls
## caution! marker: S2B_773807507 was killed due to too many missing genotype calls
## caution! marker: S2B_775396940 was killed due to too many missing genotype calls
## caution! marker: S2B_776263384 was killed due to too many missing genotype calls
## caution! marker: S2B_776409762 was killed due to too many missing genotype calls
## caution! marker: S2B_776529584 was killed due to too many missing genotype calls
## caution! marker: S2B_776529600 was killed due to too many missing genotype calls
## caution! marker: S2B_780595416 was killed due to too many missing genotype calls
## caution! marker: S2B_785074460 was killed due to too many missing genotype calls
## caution! marker: S2B_785188862 was killed due to too many missing genotype calls
## caution! marker: S2B_785188919 was killed due to too many missing genotype calls
## caution! marker: S2B_785879165 was killed due to too many missing genotype calls
## caution! marker: S2B_785905982 was killed due to too many missing genotype calls
## caution! marker: S2B_787820195 was killed due to too many missing genotype calls
## caution! marker: S2B_790234621 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 128  4   1   1   
## The number of bins in each linkage group: 72 4   1   1   
## caution! marker: S2D_13243107 was killed due to too many missing genotype calls
## caution! marker: S2D_15134145 was killed due to too many missing genotype calls
## caution! marker: S2D_57824943 was killed due to too many missing genotype calls
## caution! marker: S2D_58145168 was killed due to too many missing genotype calls
## caution! marker: S2D_63536732 was killed due to too many missing genotype calls
## caution! marker: S2D_648643877 was killed due to too many missing genotype calls
## Number of linkage groups: 9
## The size of the linkage groups are: 24   1   2   1   4   1   2   1   4   
## The number of bins in each linkage group: 12 1   1   1   4   1   1   1   1   
## caution! marker: S3A_10160485 was killed due to too many missing genotype calls
## caution! marker: S3A_12026119 was killed due to too many missing genotype calls
## caution! marker: S3A_12287287 was killed due to too many missing genotype calls
## caution! marker: S3A_12407944 was killed due to too many missing genotype calls
## caution! marker: S3A_1286032 was killed due to too many missing genotype calls
## caution! marker: S3A_1286136 was killed due to too many missing genotype calls
## caution! marker: S3A_12921895 was killed due to too many missing genotype calls
## caution! marker: S3A_13244308 was killed due to too many missing genotype calls
## caution! marker: S3A_144157542 was killed due to too many missing genotype calls
## caution! marker: S3A_15777532 was killed due to too many missing genotype calls
## caution! marker: S3A_1783449 was killed due to too many missing genotype calls
## caution! marker: S3A_19301092 was killed due to too many missing genotype calls
## caution! marker: S3A_20102450 was killed due to too many missing genotype calls
## caution! marker: S3A_20238739 was killed due to too many missing genotype calls
## caution! marker: S3A_22505423 was killed due to too many missing genotype calls
## caution! marker: S3A_36678555 was killed due to too many missing genotype calls
## caution! marker: S3A_37477876 was killed due to too many missing genotype calls
## caution! marker: S3A_45565013 was killed due to too many missing genotype calls
## caution! marker: S3A_478166110 was killed due to too many missing genotype calls
## caution! marker: S3A_483743430 was killed due to too many missing genotype calls
## caution! marker: S3A_510681430 was killed due to too many missing genotype calls
## caution! marker: S3A_512321079 was killed due to too many missing genotype calls
## caution! marker: S3A_512556966 was killed due to too many missing genotype calls
## caution! marker: S3A_52210597 was killed due to too many missing genotype calls
## caution! marker: S3A_550193790 was killed due to too many missing genotype calls
## caution! marker: S3A_550524499 was killed due to too many missing genotype calls
## caution! marker: S3A_552022102 was killed due to too many missing genotype calls
## caution! marker: S3A_556367956 was killed due to too many missing genotype calls
## caution! marker: S3A_565574099 was killed due to too many missing genotype calls
## caution! marker: S3A_56679828 was killed due to too many missing genotype calls
## caution! marker: S3A_570318062 was killed due to too many missing genotype calls
## caution! marker: S3A_570750031 was killed due to too many missing genotype calls
## caution! marker: S3A_572745436 was killed due to too many missing genotype calls
## caution! marker: S3A_600315918 was killed due to too many missing genotype calls
## caution! marker: S3A_61285901 was killed due to too many missing genotype calls
## caution! marker: S3A_628657586 was killed due to too many missing genotype calls
## caution! marker: S3A_68283065 was killed due to too many missing genotype calls
## caution! marker: S3A_684697646 was killed due to too many missing genotype calls
## caution! marker: S3A_688449924 was killed due to too many missing genotype calls
## caution! marker: S3A_688673469 was killed due to too many missing genotype calls
## caution! marker: S3A_691476010 was killed due to too many missing genotype calls
## caution! marker: S3A_695042689 was killed due to too many missing genotype calls
## caution! marker: S3A_697456503 was killed due to too many missing genotype calls
## caution! marker: S3A_699241752 was killed due to too many missing genotype calls
## caution! marker: S3A_701892218 was killed due to too many missing genotype calls
## caution! marker: S3A_702327328 was killed due to too many missing genotype calls
## caution! marker: S3A_705231937 was killed due to too many missing genotype calls
## caution! marker: S3A_707925210 was killed due to too many missing genotype calls
## caution! marker: S3A_709207023 was killed due to too many missing genotype calls
## caution! marker: S3A_714455882 was killed due to too many missing genotype calls
## caution! marker: S3A_716847059 was killed due to too many missing genotype calls
## caution! marker: S3A_722449145 was killed due to too many missing genotype calls
## caution! marker: S3A_724541183 was killed due to too many missing genotype calls
## caution! marker: S3A_726107417 was killed due to too many missing genotype calls
## caution! marker: S3A_729609875 was killed due to too many missing genotype calls
## caution! marker: S3A_731113222 was killed due to too many missing genotype calls
## caution! marker: S3A_731772531 was killed due to too many missing genotype calls
## caution! marker: S3A_73513370 was killed due to too many missing genotype calls
## caution! marker: S3A_737210825 was killed due to too many missing genotype calls
## caution! marker: S3A_88201254 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 165  1   1   1   
## The number of bins in each linkage group: 61 1   1   1   
## caution! marker: S3B_129530784 was killed due to too many missing genotype calls
## caution! marker: S3B_13505129 was killed due to too many missing genotype calls
## caution! marker: S3B_13680763 was killed due to too many missing genotype calls
## caution! marker: S3B_16589598 was killed due to too many missing genotype calls
## caution! marker: S3B_18484719 was killed due to too many missing genotype calls
## caution! marker: S3B_18569321 was killed due to too many missing genotype calls
## caution! marker: S3B_20070137 was killed due to too many missing genotype calls
## caution! marker: S3B_216180078 was killed due to too many missing genotype calls
## caution! marker: S3B_21770922 was killed due to too many missing genotype calls
## caution! marker: S3B_21863700 was killed due to too many missing genotype calls
## caution! marker: S3B_22129379 was killed due to too many missing genotype calls
## caution! marker: S3B_222247324 was killed due to too many missing genotype calls
## caution! marker: S3B_24940723 was killed due to too many missing genotype calls
## caution! marker: S3B_250270760 was killed due to too many missing genotype calls
## caution! marker: S3B_255038905 was killed due to too many missing genotype calls
## caution! marker: S3B_257999830 was killed due to too many missing genotype calls
## caution! marker: S3B_257999933 was killed due to too many missing genotype calls
## caution! marker: S3B_31366808 was killed due to too many missing genotype calls
## caution! marker: S3B_331898364 was killed due to too many missing genotype calls
## caution! marker: S3B_403907351 was killed due to too many missing genotype calls
## caution! marker: S3B_414828393 was killed due to too many missing genotype calls
## caution! marker: S3B_415897806 was killed due to too many missing genotype calls
## caution! marker: S3B_418826377 was killed due to too many missing genotype calls
## caution! marker: S3B_418882248 was killed due to too many missing genotype calls
## caution! marker: S3B_44274212 was killed due to too many missing genotype calls
## caution! marker: S3B_457011297 was killed due to too many missing genotype calls
## caution! marker: S3B_508711126 was killed due to too many missing genotype calls
## caution! marker: S3B_512743315 was killed due to too many missing genotype calls
## caution! marker: S3B_558500556 was killed due to too many missing genotype calls
## caution! marker: S3B_571534403 was killed due to too many missing genotype calls
## caution! marker: S3B_572679630 was killed due to too many missing genotype calls
## caution! marker: S3B_580784925 was killed due to too many missing genotype calls
## caution! marker: S3B_581263452 was killed due to too many missing genotype calls
## caution! marker: S3B_581976209 was killed due to too many missing genotype calls
## caution! marker: S3B_59889587 was killed due to too many missing genotype calls
## caution! marker: S3B_598995503 was killed due to too many missing genotype calls
## caution! marker: S3B_602786401 was killed due to too many missing genotype calls
## caution! marker: S3B_603576794 was killed due to too many missing genotype calls
## caution! marker: S3B_621472372 was killed due to too many missing genotype calls
## caution! marker: S3B_625779659 was killed due to too many missing genotype calls
## caution! marker: S3B_641985045 was killed due to too many missing genotype calls
## caution! marker: S3B_651703738 was killed due to too many missing genotype calls
## caution! marker: S3B_654656807 was killed due to too many missing genotype calls
## caution! marker: S3B_665244915 was killed due to too many missing genotype calls
## caution! marker: S3B_670252382 was killed due to too many missing genotype calls
## caution! marker: S3B_672873770 was killed due to too many missing genotype calls
## caution! marker: S3B_683106967 was killed due to too many missing genotype calls
## caution! marker: S3B_686735291 was killed due to too many missing genotype calls
## caution! marker: S3B_693086678 was killed due to too many missing genotype calls
## caution! marker: S3B_719818208 was killed due to too many missing genotype calls
## caution! marker: S3B_734436563 was killed due to too many missing genotype calls
## caution! marker: S3B_752439400 was killed due to too many missing genotype calls
## caution! marker: S3B_758201335 was killed due to too many missing genotype calls
## caution! marker: S3B_758373800 was killed due to too many missing genotype calls
## caution! marker: S3B_758373819 was killed due to too many missing genotype calls
## caution! marker: S3B_762027806 was killed due to too many missing genotype calls
## caution! marker: S3B_763801275 was killed due to too many missing genotype calls
## caution! marker: S3B_764076592 was killed due to too many missing genotype calls
## caution! marker: S3B_764334304 was killed due to too many missing genotype calls
## caution! marker: S3B_769190306 was killed due to too many missing genotype calls
## caution! marker: S3B_771390243 was killed due to too many missing genotype calls
## caution! marker: S3B_771761917 was killed due to too many missing genotype calls
## caution! marker: S3B_773850693 was killed due to too many missing genotype calls
## caution! marker: S3B_798395496 was killed due to too many missing genotype calls
## caution! marker: S3B_800944831 was killed due to too many missing genotype calls
## caution! marker: S3B_815300892 was killed due to too many missing genotype calls
## caution! marker: S3B_818513872 was killed due to too many missing genotype calls
## caution! marker: S3B_823078014 was killed due to too many missing genotype calls
## caution! marker: S3B_828672970 was killed due to too many missing genotype calls
## caution! marker: S3B_828795956 was killed due to too many missing genotype calls
## caution! marker: S3B_829023452 was killed due to too many missing genotype calls
## caution! marker: S3B_9439570 was killed due to too many missing genotype calls
## caution! marker: S3B_97080266 was killed due to too many missing genotype calls
## caution! marker: S3B_9927054 was killed due to too many missing genotype calls
## Number of linkage groups: 5
## The size of the linkage groups are: 216  1   1   1   1   
## The number of bins in each linkage group: 91 1   1   1   1   
## caution! marker: S3D_423130593 was killed due to too many missing genotype calls
## caution! marker: S3D_43280177 was killed due to too many missing genotype calls
## caution! marker: S3D_501076107 was killed due to too many missing genotype calls
## caution! marker: S3D_532205636 was killed due to too many missing genotype calls
## caution! marker: S3D_573418141 was killed due to too many missing genotype calls
## caution! marker: S3D_598540484 was killed due to too many missing genotype calls
## caution! marker: S3D_598671019 was killed due to too many missing genotype calls
## caution! marker: S3D_604968955 was killed due to too many missing genotype calls
## Number of linkage groups: 7
## The size of the linkage groups are: 1    1   6   1   1   1   7   
## The number of bins in each linkage group: 1  1   6   1   1   1   3   
## caution! marker: S4A_12604826 was killed due to too many missing genotype calls
## caution! marker: S4A_17889491 was killed due to too many missing genotype calls
## caution! marker: S4A_231000971 was killed due to too many missing genotype calls
## caution! marker: S4A_240020977 was killed due to too many missing genotype calls
## caution! marker: S4A_245001282 was killed due to too many missing genotype calls
## caution! marker: S4A_274104875 was killed due to too many missing genotype calls
## caution! marker: S4A_29387619 was killed due to too many missing genotype calls
## caution! marker: S4A_29456167 was killed due to too many missing genotype calls
## caution! marker: S4A_379465303 was killed due to too many missing genotype calls
## caution! marker: S4A_45144499 was killed due to too many missing genotype calls
## caution! marker: S4A_570267431 was killed due to too many missing genotype calls
## caution! marker: S4A_583968823 was killed due to too many missing genotype calls
## caution! marker: S4A_595433072 was killed due to too many missing genotype calls
## caution! marker: S4A_599575654 was killed due to too many missing genotype calls
## caution! marker: S4A_599647431 was killed due to too many missing genotype calls
## caution! marker: S4A_603046898 was killed due to too many missing genotype calls
## caution! marker: S4A_620342297 was killed due to too many missing genotype calls
## caution! marker: S4A_620613603 was killed due to too many missing genotype calls
## caution! marker: S4A_636102981 was killed due to too many missing genotype calls
## caution! marker: S4A_649801931 was killed due to too many missing genotype calls
## caution! marker: S4A_659210035 was killed due to too many missing genotype calls
## caution! marker: S4A_659705441 was killed due to too many missing genotype calls
## caution! marker: S4A_660455609 was killed due to too many missing genotype calls
## caution! marker: S4A_677941179 was killed due to too many missing genotype calls
## caution! marker: S4A_696459585 was killed due to too many missing genotype calls
## caution! marker: S4A_702126220 was killed due to too many missing genotype calls
## caution! marker: S4A_704255713 was killed due to too many missing genotype calls
## caution! marker: S4A_706675813 was killed due to too many missing genotype calls
## caution! marker: S4A_708103624 was killed due to too many missing genotype calls
## caution! marker: S4A_709206204 was killed due to too many missing genotype calls
## caution! marker: S4A_717948750 was killed due to too many missing genotype calls
## caution! marker: S4A_719112618 was killed due to too many missing genotype calls
## caution! marker: S4A_719933953 was killed due to too many missing genotype calls
## caution! marker: S4A_728280684 was killed due to too many missing genotype calls
## caution! marker: S4A_729872889 was killed due to too many missing genotype calls
## caution! marker: S4A_729895763 was killed due to too many missing genotype calls
## caution! marker: S4A_739080749 was killed due to too many missing genotype calls
## Number of linkage groups: 2
## The size of the linkage groups are: 117  4   
## The number of bins in each linkage group: 51 3   
## caution! marker: S4B_132328665 was killed due to too many missing genotype calls
## caution! marker: S4B_169921939 was killed due to too many missing genotype calls
## caution! marker: S4B_18655478 was killed due to too many missing genotype calls
## caution! marker: S4B_25485349 was killed due to too many missing genotype calls
## caution! marker: S4B_44943599 was killed due to too many missing genotype calls
## caution! marker: S4B_4852517 was killed due to too many missing genotype calls
## caution! marker: S4B_517960897 was killed due to too many missing genotype calls
## caution! marker: S4B_520404738 was killed due to too many missing genotype calls
## caution! marker: S4B_535089159 was killed due to too many missing genotype calls
## caution! marker: S4B_540718899 was killed due to too many missing genotype calls
## caution! marker: S4B_546023632 was killed due to too many missing genotype calls
## caution! marker: S4B_548121101 was killed due to too many missing genotype calls
## caution! marker: S4B_548121313 was killed due to too many missing genotype calls
## caution! marker: S4B_558060734 was killed due to too many missing genotype calls
## caution! marker: S4B_561020982 was killed due to too many missing genotype calls
## caution! marker: S4B_562355380 was killed due to too many missing genotype calls
## caution! marker: S4B_576500004 was killed due to too many missing genotype calls
## caution! marker: S4B_580774848 was killed due to too many missing genotype calls
## caution! marker: S4B_585694536 was killed due to too many missing genotype calls
## caution! marker: S4B_587061757 was killed due to too many missing genotype calls
## caution! marker: S4B_589181090 was killed due to too many missing genotype calls
## caution! marker: S4B_600166469 was killed due to too many missing genotype calls
## caution! marker: S4B_619589061 was killed due to too many missing genotype calls
## caution! marker: S4B_619935881 was killed due to too many missing genotype calls
## caution! marker: S4B_631889174 was killed due to too many missing genotype calls
## caution! marker: S4B_636460537 was killed due to too many missing genotype calls
## caution! marker: S4B_646330848 was killed due to too many missing genotype calls
## caution! marker: S4B_649578002 was killed due to too many missing genotype calls
## caution! marker: S4B_652407432 was killed due to too many missing genotype calls
## caution! marker: S4B_652980104 was killed due to too many missing genotype calls
## caution! marker: S4B_657003274 was killed due to too many missing genotype calls
## caution! marker: S4B_657992972 was killed due to too many missing genotype calls
## caution! marker: S4B_660653849 was killed due to too many missing genotype calls
## caution! marker: S4B_660664876 was killed due to too many missing genotype calls
## caution! marker: S4B_663621978 was killed due to too many missing genotype calls
## caution! marker: S4B_663662540 was killed due to too many missing genotype calls
## caution! marker: S4B_664198613 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 63   1   1   1   
## The number of bins in each linkage group: 28 1   1   1   
## caution! marker: S4D_455285893 was killed due to too many missing genotype calls
## caution! marker: S4D_455763127 was killed due to too many missing genotype calls
## caution! marker: S4D_456054449 was killed due to too many missing genotype calls
## Number of linkage groups: 2
## The size of the linkage groups are: 1    13  
## The number of bins in each linkage group: 1  9   
## caution! marker: S5A_10301112 was killed due to too many missing genotype calls
## caution! marker: S5A_11281441 was killed due to too many missing genotype calls
## caution! marker: S5A_11558716 was killed due to too many missing genotype calls
## caution! marker: S5A_18923304 was killed due to too many missing genotype calls
## caution! marker: S5A_27741539 was killed due to too many missing genotype calls
## caution! marker: S5A_28394562 was killed due to too many missing genotype calls
## caution! marker: S5A_28601518 was killed due to too many missing genotype calls
## caution! marker: S5A_30060588 was killed due to too many missing genotype calls
## caution! marker: S5A_397506855 was killed due to too many missing genotype calls
## caution! marker: S5A_400574104 was killed due to too many missing genotype calls
## caution! marker: S5A_400776896 was killed due to too many missing genotype calls
## caution! marker: S5A_406537103 was killed due to too many missing genotype calls
## caution! marker: S5A_431894778 was killed due to too many missing genotype calls
## caution! marker: S5A_433203022 was killed due to too many missing genotype calls
## caution! marker: S5A_438355410 was killed due to too many missing genotype calls
## caution! marker: S5A_455128730 was killed due to too many missing genotype calls
## caution! marker: S5A_458562272 was killed due to too many missing genotype calls
## caution! marker: S5A_473644518 was killed due to too many missing genotype calls
## caution! marker: S5A_481923892 was killed due to too many missing genotype calls
## caution! marker: S5A_485470009 was killed due to too many missing genotype calls
## caution! marker: S5A_488047668 was killed due to too many missing genotype calls
## caution! marker: S5A_488051326 was killed due to too many missing genotype calls
## caution! marker: S5A_493600030 was killed due to too many missing genotype calls
## caution! marker: S5A_528309857 was killed due to too many missing genotype calls
## caution! marker: S5A_561660493 was killed due to too many missing genotype calls
## caution! marker: S5A_570193479 was killed due to too many missing genotype calls
## caution! marker: S5A_570791931 was killed due to too many missing genotype calls
## caution! marker: S5A_570937620 was killed due to too many missing genotype calls
## caution! marker: S5A_573040321 was killed due to too many missing genotype calls
## caution! marker: S5A_577795558 was killed due to too many missing genotype calls
## caution! marker: S5A_580935013 was killed due to too many missing genotype calls
## caution! marker: S5A_581488651 was killed due to too many missing genotype calls
## caution! marker: S5A_585223490 was killed due to too many missing genotype calls
## caution! marker: S5A_597279906 was killed due to too many missing genotype calls
## caution! marker: S5A_598072175 was killed due to too many missing genotype calls
## caution! marker: S5A_599376695 was killed due to too many missing genotype calls
## caution! marker: S5A_6179472 was killed due to too many missing genotype calls
## caution! marker: S5A_633455949 was killed due to too many missing genotype calls
## caution! marker: S5A_640103433 was killed due to too many missing genotype calls
## caution! marker: S5A_671385584 was killed due to too many missing genotype calls
## caution! marker: S5A_680073489 was killed due to too many missing genotype calls
## caution! marker: S5A_680903923 was killed due to too many missing genotype calls
## caution! marker: S5A_680980888 was killed due to too many missing genotype calls
## caution! marker: S5A_681251635 was killed due to too many missing genotype calls
## caution! marker: S5A_688359724 was killed due to too many missing genotype calls
## caution! marker: S5A_689416952 was killed due to too many missing genotype calls
## caution! marker: S5A_692272597 was killed due to too many missing genotype calls
## caution! marker: S5A_692832158 was killed due to too many missing genotype calls
## caution! marker: S5A_6982425 was killed due to too many missing genotype calls
## caution! marker: S5A_702504844 was killed due to too many missing genotype calls
## caution! marker: S5A_8238951 was killed due to too many missing genotype calls
## caution! marker: S5A_9845562 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 145  1   1   1   
## The number of bins in each linkage group: 76 1   1   1   
## caution! marker: S5B_2055531 was killed due to too many missing genotype calls
## caution! marker: S5B_231095747 was killed due to too many missing genotype calls
## caution! marker: S5B_448847093 was killed due to too many missing genotype calls
## caution! marker: S5B_458663156 was killed due to too many missing genotype calls
## caution! marker: S5B_471381890 was killed due to too many missing genotype calls
## caution! marker: S5B_473610078 was killed due to too many missing genotype calls
## caution! marker: S5B_489578862 was killed due to too many missing genotype calls
## caution! marker: S5B_545169845 was killed due to too many missing genotype calls
## caution! marker: S5B_547368152 was killed due to too many missing genotype calls
## caution! marker: S5B_548934823 was killed due to too many missing genotype calls
## caution! marker: S5B_549082730 was killed due to too many missing genotype calls
## caution! marker: S5B_549953533 was killed due to too many missing genotype calls
## caution! marker: S5B_550166737 was killed due to too many missing genotype calls
## caution! marker: S5B_550192735 was killed due to too many missing genotype calls
## caution! marker: S5B_585262568 was killed due to too many missing genotype calls
## caution! marker: S5B_588757384 was killed due to too many missing genotype calls
## caution! marker: S5B_595121907 was killed due to too many missing genotype calls
## caution! marker: S5B_596543883 was killed due to too many missing genotype calls
## caution! marker: S5B_596841873 was killed due to too many missing genotype calls
## caution! marker: S5B_60876109 was killed due to too many missing genotype calls
## caution! marker: S5B_615199008 was killed due to too many missing genotype calls
## caution! marker: S5B_621212430 was killed due to too many missing genotype calls
## caution! marker: S5B_622394626 was killed due to too many missing genotype calls
## caution! marker: S5B_640288558 was killed due to too many missing genotype calls
## caution! marker: S5B_640396431 was killed due to too many missing genotype calls
## caution! marker: S5B_665938696 was killed due to too many missing genotype calls
## caution! marker: S5B_679181735 was killed due to too many missing genotype calls
## caution! marker: S5B_67969399 was killed due to too many missing genotype calls
## caution! marker: S5B_680769401 was killed due to too many missing genotype calls
## caution! marker: S5B_70563357 was killed due to too many missing genotype calls
## caution! marker: S5B_710940763 was killed due to too many missing genotype calls
## caution! marker: S5B_710946636 was killed due to too many missing genotype calls
## caution! marker: S5B_71990789 was killed due to too many missing genotype calls
## caution! marker: S5B_81396103 was killed due to too many missing genotype calls
## Number of linkage groups: 2
## The size of the linkage groups are: 97   5   
## The number of bins in each linkage group: 42 2   
## caution! marker: S5D_27492889 was killed due to too many missing genotype calls
## caution! marker: S5D_439980160 was killed due to too many missing genotype calls
## caution! marker: S5D_440246810 was killed due to too many missing genotype calls
## caution! marker: S5D_549984729 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 2    15  1   4   
## The number of bins in each linkage group: 2  11  1   3   
## caution! marker: S6A_100363142 was killed due to too many missing genotype calls
## caution! marker: S6A_106479262 was killed due to too many missing genotype calls
## caution! marker: S6A_114455762 was killed due to too many missing genotype calls
## caution! marker: S6A_135562761 was killed due to too many missing genotype calls
## caution! marker: S6A_28410585 was killed due to too many missing genotype calls
## caution! marker: S6A_2953873 was killed due to too many missing genotype calls
## caution! marker: S6A_34545288 was killed due to too many missing genotype calls
## caution! marker: S6A_35836093 was killed due to too many missing genotype calls
## caution! marker: S6A_3691870 was killed due to too many missing genotype calls
## caution! marker: S6A_3691880 was killed due to too many missing genotype calls
## caution! marker: S6A_38379154 was killed due to too many missing genotype calls
## caution! marker: S6A_421525683 was killed due to too many missing genotype calls
## caution! marker: S6A_426173022 was killed due to too many missing genotype calls
## caution! marker: S6A_496830820 was killed due to too many missing genotype calls
## caution! marker: S6A_51769720 was killed due to too many missing genotype calls
## caution! marker: S6A_52797562 was killed due to too many missing genotype calls
## caution! marker: S6A_53158552 was killed due to too many missing genotype calls
## caution! marker: S6A_53159132 was killed due to too many missing genotype calls
## caution! marker: S6A_582511213 was killed due to too many missing genotype calls
## caution! marker: S6A_583094252 was killed due to too many missing genotype calls
## caution! marker: S6A_584719935 was killed due to too many missing genotype calls
## caution! marker: S6A_595165805 was killed due to too many missing genotype calls
## caution! marker: S6A_597782518 was killed due to too many missing genotype calls
## caution! marker: S6A_599172742 was killed due to too many missing genotype calls
## caution! marker: S6A_609479343 was killed due to too many missing genotype calls
## caution! marker: S6A_609550185 was killed due to too many missing genotype calls
## caution! marker: S6A_611197380 was killed due to too many missing genotype calls
## caution! marker: S6A_611414381 was killed due to too many missing genotype calls
## caution! marker: S6A_614663607 was killed due to too many missing genotype calls
## caution! marker: S6A_615815033 was killed due to too many missing genotype calls
## caution! marker: S6A_62812322 was killed due to too many missing genotype calls
## caution! marker: S6A_63210155 was killed due to too many missing genotype calls
## caution! marker: S6A_684328 was killed due to too many missing genotype calls
## caution! marker: S6A_7304018 was killed due to too many missing genotype calls
## caution! marker: S6A_74106770 was killed due to too many missing genotype calls
## caution! marker: S6A_74845696 was killed due to too many missing genotype calls
## caution! marker: S6A_76758286 was killed due to too many missing genotype calls
## caution! marker: S6A_90214473 was killed due to too many missing genotype calls
## caution! marker: S6A_91330099 was killed due to too many missing genotype calls
## caution! marker: S6A_91882491 was killed due to too many missing genotype calls
## caution! marker: S6A_93205668 was killed due to too many missing genotype calls
## caution! marker: S6A_956005 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 104  11  2   1   
## The number of bins in each linkage group: 46 7   2   1   
## caution! marker: S6B_101534607 was killed due to too many missing genotype calls
## caution! marker: S6B_101666627 was killed due to too many missing genotype calls
## caution! marker: S6B_107120686 was killed due to too many missing genotype calls
## caution! marker: S6B_107123257 was killed due to too many missing genotype calls
## caution! marker: S6B_107711988 was killed due to too many missing genotype calls
## caution! marker: S6B_120683262 was killed due to too many missing genotype calls
## caution! marker: S6B_123207887 was killed due to too many missing genotype calls
## caution! marker: S6B_124647441 was killed due to too many missing genotype calls
## caution! marker: S6B_130076243 was killed due to too many missing genotype calls
## caution! marker: S6B_153532546 was killed due to too many missing genotype calls
## caution! marker: S6B_158288115 was killed due to too many missing genotype calls
## caution! marker: S6B_15928467 was killed due to too many missing genotype calls
## caution! marker: S6B_163950110 was killed due to too many missing genotype calls
## caution! marker: S6B_200325559 was killed due to too many missing genotype calls
## caution! marker: S6B_27649803 was killed due to too many missing genotype calls
## caution! marker: S6B_28730009 was killed due to too many missing genotype calls
## caution! marker: S6B_34091815 was killed due to too many missing genotype calls
## caution! marker: S6B_35706383 was killed due to too many missing genotype calls
## caution! marker: S6B_42233236 was killed due to too many missing genotype calls
## caution! marker: S6B_457663546 was killed due to too many missing genotype calls
## caution! marker: S6B_467911691 was killed due to too many missing genotype calls
## caution! marker: S6B_474215642 was killed due to too many missing genotype calls
## caution! marker: S6B_4889493 was killed due to too many missing genotype calls
## caution! marker: S6B_675392193 was killed due to too many missing genotype calls
## caution! marker: S6B_676372396 was killed due to too many missing genotype calls
## caution! marker: S6B_679640228 was killed due to too many missing genotype calls
## caution! marker: S6B_679743920 was killed due to too many missing genotype calls
## caution! marker: S6B_681205257 was killed due to too many missing genotype calls
## caution! marker: S6B_681427605 was killed due to too many missing genotype calls
## caution! marker: S6B_696080382 was killed due to too many missing genotype calls
## caution! marker: S6B_699542793 was killed due to too many missing genotype calls
## caution! marker: S6B_710012334 was killed due to too many missing genotype calls
## caution! marker: S6B_712227046 was killed due to too many missing genotype calls
## caution! marker: S6B_713463843 was killed due to too many missing genotype calls
## caution! marker: S6B_714642535 was killed due to too many missing genotype calls
## caution! marker: S6B_715630909 was killed due to too many missing genotype calls
## caution! marker: S6B_715938382 was killed due to too many missing genotype calls
## caution! marker: S6B_717419685 was killed due to too many missing genotype calls
## caution! marker: S6B_98659486 was killed due to too many missing genotype calls
## Number of linkage groups: 3
## The size of the linkage groups are: 116  1   1   
## The number of bins in each linkage group: 52 1   1   
## caution! marker: S6D_10510892 was killed due to too many missing genotype calls
## caution! marker: S6D_20088111 was killed due to too many missing genotype calls
## caution! marker: S6D_20802028 was killed due to too many missing genotype calls
## caution! marker: S6D_2098364 was killed due to too many missing genotype calls
## caution! marker: S6D_336361538 was killed due to too many missing genotype calls
## caution! marker: S6D_341460765 was killed due to too many missing genotype calls
## caution! marker: S6D_4425040 was killed due to too many missing genotype calls
## caution! marker: S6D_454940719 was killed due to too many missing genotype calls
## caution! marker: S6D_455735681 was killed due to too many missing genotype calls
## caution! marker: S6D_455735940 was killed due to too many missing genotype calls
## caution! marker: S6D_456325441 was killed due to too many missing genotype calls
## caution! marker: S6D_456367377 was killed due to too many missing genotype calls
## caution! marker: S6D_457723702 was killed due to too many missing genotype calls
## caution! marker: S6D_460103586 was killed due to too many missing genotype calls
## caution! marker: S6D_460468227 was killed due to too many missing genotype calls
## caution! marker: S6D_4627111 was killed due to too many missing genotype calls
## caution! marker: S6D_4629773 was killed due to too many missing genotype calls
## caution! marker: S6D_463680438 was killed due to too many missing genotype calls
## caution! marker: S6D_466537410 was killed due to too many missing genotype calls
## caution! marker: S6D_5845567 was killed due to too many missing genotype calls
## caution! marker: S6D_6745772 was killed due to too many missing genotype calls
## caution! marker: S6D_919226 was killed due to too many missing genotype calls
## Number of linkage groups: 2
## The size of the linkage groups are: 48   2   
## The number of bins in each linkage group: 23 2   
## caution! marker: S7A_12913553 was killed due to too many missing genotype calls
## caution! marker: S7A_13179057 was killed due to too many missing genotype calls
## caution! marker: S7A_1525093 was killed due to too many missing genotype calls
## caution! marker: S7A_16302867 was killed due to too many missing genotype calls
## caution! marker: S7A_163372914 was killed due to too many missing genotype calls
## caution! marker: S7A_19178431 was killed due to too many missing genotype calls
## caution! marker: S7A_22154933 was killed due to too many missing genotype calls
## caution! marker: S7A_22894976 was killed due to too many missing genotype calls
## caution! marker: S7A_248334159 was killed due to too many missing genotype calls
## caution! marker: S7A_24940330 was killed due to too many missing genotype calls
## caution! marker: S7A_261396954 was killed due to too many missing genotype calls
## caution! marker: S7A_26768261 was killed due to too many missing genotype calls
## caution! marker: S7A_279992545 was killed due to too many missing genotype calls
## caution! marker: S7A_288054873 was killed due to too many missing genotype calls
## caution! marker: S7A_29250060 was killed due to too many missing genotype calls
## caution! marker: S7A_29491762 was killed due to too many missing genotype calls
## caution! marker: S7A_30089307 was killed due to too many missing genotype calls
## caution! marker: S7A_31133774 was killed due to too many missing genotype calls
## caution! marker: S7A_32179154 was killed due to too many missing genotype calls
## caution! marker: S7A_32952522 was killed due to too many missing genotype calls
## caution! marker: S7A_335910317 was killed due to too many missing genotype calls
## caution! marker: S7A_3426596 was killed due to too many missing genotype calls
## caution! marker: S7A_35769647 was killed due to too many missing genotype calls
## caution! marker: S7A_36633756 was killed due to too many missing genotype calls
## caution! marker: S7A_41924480 was killed due to too many missing genotype calls
## caution! marker: S7A_42498101 was killed due to too many missing genotype calls
## caution! marker: S7A_4463112 was killed due to too many missing genotype calls
## caution! marker: S7A_47049602 was killed due to too many missing genotype calls
## caution! marker: S7A_47709128 was killed due to too many missing genotype calls
## caution! marker: S7A_514434843 was killed due to too many missing genotype calls
## caution! marker: S7A_514898952 was killed due to too many missing genotype calls
## caution! marker: S7A_53892882 was killed due to too many missing genotype calls
## caution! marker: S7A_545935120 was killed due to too many missing genotype calls
## caution! marker: S7A_562613157 was killed due to too many missing genotype calls
## caution! marker: S7A_568117361 was killed due to too many missing genotype calls
## caution! marker: S7A_569088259 was killed due to too many missing genotype calls
## caution! marker: S7A_573097562 was killed due to too many missing genotype calls
## caution! marker: S7A_573128811 was killed due to too many missing genotype calls
## caution! marker: S7A_639837597 was killed due to too many missing genotype calls
## caution! marker: S7A_641050335 was killed due to too many missing genotype calls
## caution! marker: S7A_646930742 was killed due to too many missing genotype calls
## caution! marker: S7A_648397710 was killed due to too many missing genotype calls
## caution! marker: S7A_652356917 was killed due to too many missing genotype calls
## caution! marker: S7A_652760637 was killed due to too many missing genotype calls
## caution! marker: S7A_654563991 was killed due to too many missing genotype calls
## caution! marker: S7A_657418735 was killed due to too many missing genotype calls
## caution! marker: S7A_658913762 was killed due to too many missing genotype calls
## caution! marker: S7A_659407499 was killed due to too many missing genotype calls
## caution! marker: S7A_660936870 was killed due to too many missing genotype calls
## caution! marker: S7A_660936881 was killed due to too many missing genotype calls
## caution! marker: S7A_671934015 was killed due to too many missing genotype calls
## caution! marker: S7A_675198718 was killed due to too many missing genotype calls
## caution! marker: S7A_676422862 was killed due to too many missing genotype calls
## caution! marker: S7A_677723013 was killed due to too many missing genotype calls
## caution! marker: S7A_681696004 was killed due to too many missing genotype calls
## caution! marker: S7A_681708060 was killed due to too many missing genotype calls
## caution! marker: S7A_68188764 was killed due to too many missing genotype calls
## caution! marker: S7A_682078313 was killed due to too many missing genotype calls
## caution! marker: S7A_682197682 was killed due to too many missing genotype calls
## caution! marker: S7A_683515686 was killed due to too many missing genotype calls
## caution! marker: S7A_684264902 was killed due to too many missing genotype calls
## caution! marker: S7A_688877776 was killed due to too many missing genotype calls
## caution! marker: S7A_690839620 was killed due to too many missing genotype calls
## caution! marker: S7A_692202279 was killed due to too many missing genotype calls
## caution! marker: S7A_694885254 was killed due to too many missing genotype calls
## caution! marker: S7A_697067660 was killed due to too many missing genotype calls
## caution! marker: S7A_699149790 was killed due to too many missing genotype calls
## caution! marker: S7A_700067019 was killed due to too many missing genotype calls
## caution! marker: S7A_705593635 was killed due to too many missing genotype calls
## caution! marker: S7A_705593710 was killed due to too many missing genotype calls
## caution! marker: S7A_716611061 was killed due to too many missing genotype calls
## caution! marker: S7A_720348490 was killed due to too many missing genotype calls
## caution! marker: S7A_730508998 was killed due to too many missing genotype calls
## caution! marker: S7A_731131068 was killed due to too many missing genotype calls
## caution! marker: S7A_7592185 was killed due to too many missing genotype calls
## caution! marker: S7A_78464287 was killed due to too many missing genotype calls
## caution! marker: S7A_82501050 was killed due to too many missing genotype calls
## caution! marker: S7A_8263550 was killed due to too many missing genotype calls
## caution! marker: S7A_82946533 was killed due to too many missing genotype calls
## caution! marker: S7A_82950729 was killed due to too many missing genotype calls
## caution! marker: S7A_8774152 was killed due to too many missing genotype calls
## Number of linkage groups: 5
## The size of the linkage groups are: 207  1   1   1   1   
## The number of bins in each linkage group: 110    1   1   1   1   
## caution! marker: S7B_10160986 was killed due to too many missing genotype calls
## caution! marker: S7B_124548883 was killed due to too many missing genotype calls
## caution! marker: S7B_125768996 was killed due to too many missing genotype calls
## caution! marker: S7B_13302267 was killed due to too many missing genotype calls
## caution! marker: S7B_24059487 was killed due to too many missing genotype calls
## caution! marker: S7B_24277247 was killed due to too many missing genotype calls
## caution! marker: S7B_24403262 was killed due to too many missing genotype calls
## caution! marker: S7B_3505031 was killed due to too many missing genotype calls
## caution! marker: S7B_36484350 was killed due to too many missing genotype calls
## caution! marker: S7B_37599825 was killed due to too many missing genotype calls
## caution! marker: S7B_41332104 was killed due to too many missing genotype calls
## caution! marker: S7B_41637766 was killed due to too many missing genotype calls
## caution! marker: S7B_44871836 was killed due to too many missing genotype calls
## caution! marker: S7B_468000773 was killed due to too many missing genotype calls
## caution! marker: S7B_488370374 was killed due to too many missing genotype calls
## caution! marker: S7B_60863539 was killed due to too many missing genotype calls
## caution! marker: S7B_62501249 was killed due to too many missing genotype calls
## caution! marker: S7B_64780941 was killed due to too many missing genotype calls
## caution! marker: S7B_651944265 was killed due to too many missing genotype calls
## caution! marker: S7B_651944323 was killed due to too many missing genotype calls
## caution! marker: S7B_653104564 was killed due to too many missing genotype calls
## caution! marker: S7B_65376968 was killed due to too many missing genotype calls
## caution! marker: S7B_653885689 was killed due to too many missing genotype calls
## caution! marker: S7B_655653769 was killed due to too many missing genotype calls
## caution! marker: S7B_680547034 was killed due to too many missing genotype calls
## caution! marker: S7B_68656051 was killed due to too many missing genotype calls
## caution! marker: S7B_698925394 was killed due to too many missing genotype calls
## caution! marker: S7B_701167748 was killed due to too many missing genotype calls
## caution! marker: S7B_703983462 was killed due to too many missing genotype calls
## caution! marker: S7B_707713993 was killed due to too many missing genotype calls
## caution! marker: S7B_709245392 was killed due to too many missing genotype calls
## caution! marker: S7B_709531013 was killed due to too many missing genotype calls
## caution! marker: S7B_709592360 was killed due to too many missing genotype calls
## caution! marker: S7B_712860131 was killed due to too many missing genotype calls
## caution! marker: S7B_713042159 was killed due to too many missing genotype calls
## caution! marker: S7B_716399493 was killed due to too many missing genotype calls
## caution! marker: S7B_719078053 was killed due to too many missing genotype calls
## caution! marker: S7B_720548366 was killed due to too many missing genotype calls
## caution! marker: S7B_720828759 was killed due to too many missing genotype calls
## caution! marker: S7B_724774915 was killed due to too many missing genotype calls
## caution! marker: S7B_725761332 was killed due to too many missing genotype calls
## caution! marker: S7B_726453091 was killed due to too many missing genotype calls
## caution! marker: S7B_727867443 was killed due to too many missing genotype calls
## caution! marker: S7B_733461150 was killed due to too many missing genotype calls
## caution! marker: S7B_736026429 was killed due to too many missing genotype calls
## caution! marker: S7B_742116525 was killed due to too many missing genotype calls
## caution! marker: S7B_745586402 was killed due to too many missing genotype calls
## caution! marker: S7B_801473 was killed due to too many missing genotype calls
## caution! marker: S7B_891235 was killed due to too many missing genotype calls
## Number of linkage groups: 4
## The size of the linkage groups are: 106  1   1   1   
## The number of bins in each linkage group: 50 1   1   1   
## caution! marker: S7D_10009686 was killed due to too many missing genotype calls
## caution! marker: S7D_10726864 was killed due to too many missing genotype calls
## caution! marker: S7D_109518724 was killed due to too many missing genotype calls
## caution! marker: S7D_109526849 was killed due to too many missing genotype calls
## caution! marker: S7D_112425066 was killed due to too many missing genotype calls
## caution! marker: S7D_11950645 was killed due to too many missing genotype calls
## caution! marker: S7D_14769127 was killed due to too many missing genotype calls
## caution! marker: S7D_155691310 was killed due to too many missing genotype calls
## caution! marker: S7D_201977415 was killed due to too many missing genotype calls
## caution! marker: S7D_220991869 was killed due to too many missing genotype calls
## caution! marker: S7D_399422889 was killed due to too many missing genotype calls
## caution! marker: S7D_412609384 was killed due to too many missing genotype calls
## caution! marker: S7D_514750308 was killed due to too many missing genotype calls
## caution! marker: S7D_515824464 was killed due to too many missing genotype calls
## caution! marker: S7D_529044228 was killed due to too many missing genotype calls
## caution! marker: S7D_5310891 was killed due to too many missing genotype calls
## caution! marker: S7D_55083057 was killed due to too many missing genotype calls
## caution! marker: S7D_58493344 was killed due to too many missing genotype calls
## caution! marker: S7D_58500973 was killed due to too many missing genotype calls
## caution! marker: S7D_6136243 was killed due to too many missing genotype calls
## caution! marker: S7D_6478038 was killed due to too many missing genotype calls
## caution! marker: S7D_82443694 was killed due to too many missing genotype calls
## caution! marker: S7D_8347181 was killed due to too many missing genotype calls
## Number of linkage groups: 8
## The size of the linkage groups are: 35   1   3   1   1   2   4   1   
## The number of bins in each linkage group: 22 1   2   1   1   2   4   1   
# Jitter map to improve marker distances
cross_file <- jittermap(cross_file)

# Subset and filter linkage groups
marker_count <- sapply(cross_file$geno, function(x) length(x$map))
marker_count <- data.frame(Chr = names(marker_count), n = marker_count) %>%
  filter(n > 6 & !Chr %in% c("1A.2", "6A.2"))
cross_file <- subset(cross_file, chr = marker_count$Chr)
cross_file <- jittermap(cross_file)

# Rename linkage groups
names(cross_file$geno) <- chromosomes

# Remove unnecessary objects
remove(marker_count)

# Check map metrics
nphe(cross_file)
## [1] 29
nind(cross_file)
## [1] 166
nchr(cross_file)
## [1] 21
summary(cross_file)
##     Doubled haploids
## 
##     No. individuals:    166 
## 
##     No. phenotypes:     29 
##     Percent phenotyped: 100 99.4 99.4 99.4 100 98.2 98.2 98.2 98.2 97.6 98.2 
##                         98.2 98.2 98.2 98.8 98.8 98.8 98.8 98.2 98.2 98.2 94.6 
##                         97.6 98.8 98.8 98.8 98.8 98.8 98.8 
## 
##     No. chromosomes:    21 
##         Autosomes:      1A 1B 1D 2A 2B 2D 3A 3B 3D 4A 4B 4D 5A 5B 5D 6A 6B 6D 7A 
##                         7B 7D 
## 
##     Total markers:      1984 
##     No. markers:        89 126 47 116 128 24 165 216 7 117 63 13 145 97 15 104 
##                         116 48 207 106 35 
##     Percent genotyped:  92.4 
##     Genotypes (%):      AA:49.5  BB:50.5
# Plot linkage map
plotMap(cross_file, horizontal = FALSE, shift = FALSE, main = "NC13-20076 Double Haploid Linkage Map")

# Function to compare cM vs BP position
compare_bp_to_cm <- function(x){
  # Pull marker names
  mn <- markernames(x)
  
  # Pull positions of markers
  pos <- find.markerpos(x, mn)
  
  # Pull in rownames
  pos <- rownames_to_column(pos, var = "BP_Location")
  
  # Split the column BP_Location into a and b
  pos <- tidyr::separate(pos, BP_Location, into = c("a", "b"), sep = "_")
  
  # Rename columns
  colnames(pos) <- c("trash", "BP", "Chr", "cM")
  
  # Pull the three columns listed
  pos <- pos[, c("Chr", "BP", "cM")]
  
  # Bind marker names with their chromosme and positions
  pos <- cbind(mn, pos)
  
  # Rename columns
  colnames(pos) <- c("Markers", "Chr", "BP", "cM")
  
  # Make sure the BP and cM positions are numeric columns
  pos[, 3:4] <- lapply(pos[, 3:4], as.numeric)
  
  # Return the position dataframe 
  return(pos)
}

# Compare cM vs BP for each chromosome
pos <- compare_bp_to_cm(cross_file)

# Check and flip chromosome order if necessary
for (i in names(cross_file$geno)) {
  # Make an object that has only the curren chromosome
  q <- pos %>% filter(Chr == i)
  # If the first makrer pysical positon is greater than the last marker pysical position
  if (q[1, 3] > q[nrow(q), 3]) {
    # Print message
    print_message <- paste(paste("### Chromosome", i, "has been flipped ###"))
    print(paste(rep("#", nchar(print_message)), collapse = ""))
    print(print_message)
    print(paste(rep("#", nchar(print_message)), collapse = ""))
    
    # Then flip the linkage group
    cross_file <- flip.order(cross_file, i)
    
    # Remove the temporary dataframe 
    remove(q, print_message)
  } else {
    # Remove the temporary dataframe 
    remove(q)
  }
}
## [1] "######################################"
## [1] "### Chromosome 3D has been flipped ###"
## [1] "######################################"
## [1] "######################################"
## [1] "### Chromosome 7D has been flipped ###"
## [1] "######################################"
# Re-calculate positions after potential flipping
pos <- compare_bp_to_cm(cross_file)

# Plot cM vs BP again
ggplot(data = pos, aes(x = cM, y = BP / 1000000)) +
  geom_point() +
  facet_wrap(~Chr, ncol = 3, scales = "fixed") +
  coord_cartesian(ylim = c(0, 800), xlim = c(0, 250)) +
  labs(title = "Centimorgan Position vs. Megabase Pair",
       x = "Centimorgan (cM) Position",
       y = "Megabase Pair (Mbp) Position")

# Save the plot
ggsave(plot = last_plot(),
       filename = "cM_vs_bp_comparison.jpg",
       units = "in", width = 8, height = 12, dpi = 320)

# Remove temporary objects
remove(pos)

# Write final cross file
write.cross(cross_file,
            format = "csv",
            filestem = "rqtl_input_file_final")

Find potential selfs

# # Find potential selfs
# potential_selfs <- pull.geno(cross_file)
# rownames(potential_selfs) <- cross_file$pheno$GENOTYPE
# potential_selfs <- t(potential_selfs)
# 
# # make a function to get counts
# count_values <- function(column) {
#   return(c(count_A = sum(column == 1, na.rm = TRUE),
#            count_B = sum(column == 2, na.rm = TRUE),
#            count_NA = sum(is.na(column))))
# }
# 
# # Make an object to bind on 
# check <- c()
# 
# # Bind in 
# for(i in 1:ncol(potential_selfs)){
#   
#   temp1<-data.frame(GENOTYPE=colnames(potential_selfs)[i],
#                     t(count_values(potential_selfs[,i])))
#   temp1$x2<-c(chisq.test(x = temp1[,2:3], p = rep(0.5, 2))$statistic)
#   temp1$p.value<-c(chisq.test(x = temp1[,2:3], p = rep(0.5, 2))$p.value)
#   check <-rbind(check, temp1)
#   remove(temp1)
#   
# }
# 
# # List of potential selfs
# potential_selfs <- check %>% filter(p.value<=1e-80)
# 
# # Write selfs
# write.csv(potential_selfs,
#           "list_of_potential_selfs.csv",
#           row.names = FALSE)

QTL analysis without covariates - HD, PH, VR, FDK, DON

# Calculate marker probabilities
cross_file<-calc.genoprob(cross_file, 
                          step=2.0, 
                          off.end=0.0, 
                          error.prob=1.0e-4, 
                          map.function="kosambi",
                          stepwidth="fixed")

# Calculate marker probabilities for a simulated genotype
cross_file<-sim.geno(cross_file, 
                     n.draws = 128, 
                     step = 2, 
                     off.end = 0.0, 
                     error.prob=1.0e-4, 
                     map.function="kosambi", 
                     stepwidth="fixed")

# Set the number of permutations
nperms=1000

# Pull traits
traits<-names(cross_file$pheno)[-1]

# Covariates - set to null if none are specified 
qtl_covariates <- NULL

# Make results vector
results<-list()

# Run initial interval mapping and pull out QTL
for (i in traits){
  
  # Announce 
  print(paste("------------ Interval Mapping of", i,"------------"))
  
  # Perform IM with multiple imputation method
  print("Interval mapping...")
  scans <- scanone(cross_file, 
                   pheno.col = i,
                   addcovar = qtl_covariates,
                   model = "normal", 
                   method = "hk") 
  print("Done")
  
  # Perform IM permutations mapping to define significance threshold
  print("Permutational interval mapping...")
  perms <- scanone(cross_file, 
                   pheno.col = i, 
                   addcovar = qtl_covariates,
                   model = "normal", 
                   method = "hk", 
                   n.perm = nperms, 
                   n.cluster = parallel::detectCores()-1) #set threshold
  print("Done")
  
  # Plot QTL Scan
  print("Plotting...")
  threshold <- summary(perms, alpha=0.05)
  plot(scans,main=paste("IM for", i)) 
  abline(h = threshold, lty = "dotted", lwd = 1, col="#cc0000")
  legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
  
  # Print plot
  jpeg(paste("Scan_IM_", i, ".jpg", sep = ""),
       width = 11,
       height = 4,
       units = "in",
       res = 320)
  threshold <- summary(perms, alpha=0.05)
  plot(scans, main = paste("IM for", i)) 
  abline(h = threshold, lty = "dotted", lwd = 1, col = "#cc0000")
  legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
  dev.off()
  print("Done")
  
  # Show the peak markers for QTL
  print("Defining QTL...")
  qtl <- summary(scans, 
                 perm = perms, 
                 lodcolum = 1, 
                 alpha=0.05)
  
  # Place outputs in lists
  results$IM$scan[[i]] <- scans # Place the scan a the list
  results$IM$perms[[i]] <- perms # Place the permutations a the list
  results$IM$threshold[[i]] <- threshold # Place the thresholds a the list
  
  # If not QTL is found
  if(nrow(qtl)==0){
    # Print out
    print("No QTL identified in initial scan... Moving onto next trait!")
    next
  }
  
  # Rename QTL to identify which scan they came from
  qtl$name <- paste("IM_", qtl$chr, "-pos-", qtl$pos, sep = "")
  print("Done")
  
  # Define the QTL locations and effects
  print("Drawing QTL...")
  colnames(scans) <- c("chr", "pos", "lod")
  
  # Set up objects for defining QTL
  c <- qtl[,1] # Define the chromosomes where QTL are found
  p <- qtl[,2] # Define the positions of the QTL
  a <- subset(cross_file, chr=c) # Subset the chromosomes where QTL are found
  
  # Make new cross with genome subset
  a <- sim.geno(a, 
                n.draws = 128, 
                step = 2, 
                off.end = 0.0, 
                error.prob = 1.0e-4, 
                map.function = "kosambi", 
                stepwidth = "fixed")
  
  # Make a QTL object from that subset
  madeqtl <- makeqtl(a, 
                     c, 
                     p, 
                     qtl.name = qtl[,4], 
                     what = c("prob")) 

  # Place that QTL object in a list
  results$IM$qtl[[i]] <- madeqtl 
  print("Done")
  
  # Announce
  print("Running drop-one QTL analysis to check significance...")
  
  # Test the significance of those QTL using drop one analysis
  qtlfit <- fitqtl(cross_file, 
                   qtl = results$IM$qtl[[i]], 
                   pheno.col = i,
                   model = "normal", 
                   method = "hk") 
  
  # Remove insignificant QTL
  if(!is.null(qtlfit$result.drop)){
    # Make an object of the drop results of the fit QTL object
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the insignificant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Make a dataframe with insignificant QTL
    a <- data.frame(name = rownames(a[a$sig==0,]))
    
    # Drop those QTL
    madeqtl <- dropfromqtl(madeqtl,
                           qtl.name = a$name)
    
    # Put that in object
    results$IM$qtl[[i]] <- madeqtl 
    
    # Remove temporary 
    remove(a,c,p,scans,perms,threshold)
  }else{
    # Remove temporary dataframes
    remove(a,c,p,scans,perms,threshold)
  }
  
  # Set vectors outside the loop
  j=1
  
  # Make initial check object
  qtl_check<-results$IM$qtl[[i]]
  
  # Run MQM until no significant peaks
  repeat{
    
    # Announce  
    print(paste("-------- Performing Additional QTL Scan for Trait", i,"--------"))
    
    # Run multiple QTL mapping
    mqm <- addqtl(cross = cross_file, 
                  pheno.col = i, 
                  qtl = qtl_check, 
                  covar = qtl_covariates, 
                  method = "hk")
    
    # Put that in the list
    results[[paste("MQM", j, sep="")]]$scan[[i]] <- mqm
    
    # Plot QTL Scan
    print("Plotting...")
    plot(mqm, main = paste("MQM", j, "for", i)) 
    abline(h = results$IM$threshold[[i]], lty = "dotted", lwd = 1, col = "#cc0000")
    legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
    print("Done")
    
    # Write out picture to directory
    jpeg(paste("Scan_",paste("MQM", j, sep=""),"_", i, ".jpg", sep = ""),
     width = 11,
     height = 4,
     units = "in",
     res = 320)
    plot(mqm, main = paste("MQM", j, "for", i)) 
    abline(h = results$IM$threshold[[i]], lty = "dotted", lwd = 1, col = "#cc0000")
    legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
    dev.off()

    #make a qtl object
    qtl <- summary(mqm, 
                   perm = results$IM$perms[[i]], 
                   lodcolum = 1, 
                   alpha = 0.05)
  
    if(nrow(qtl)==0){
      # Make a null object in the list of list
      results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- NULL
      
      # Announce
      print(paste("There were no new QTL identified for", i, "aborting loop"))
      
      # Break the loop
      break
    }else{
      # Rename QTL to identify which scan they came from
      qtl$name=paste(paste("MQM", j, "_", sep=""), qtl$chr,"-pos-",qtl$pos,sep="")
       
      # Defining QTL
      print("Drawing new QTL")
      c<-qtl[,1] # Define the chromosomes where QTL are found
      p<-qtl[,2] # Define the positions of the QTL
      a<-subset(cross_file, chr=c) # Subset the chromosomes where QTL are found
       
      # Simulate the genome for that subset
      a <- sim.geno(a, 
                    n.draws = 128, 
                    step = 2, 
                    off.end = 0.0, 
                    error.prob = 1.0e-4, 
                    map.function = "kosambi", 
                    stepwidth = "fixed") 
       
      # Make a QTL object from that subset
      madeqtl <- makeqtl(a, 
                         c, 
                         p, 
                         qtl.name = qtl[,4], 
                         what = c("prob")) 
   
      # Place that QTL object in a list
      results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- madeqtl 
      print("Done")
      
      # Announce
      print("Running drop-one QTL analysis...")
       
      # Test the significance of those QTL using dropone analysis
      qtlfit <- fitqtl(cross_file, 
                       qtl = madeqtl, 
                       pheno.col = i, 
                       get.ests = T,
                       model = "normal", 
                       method = "hk") 
      
      # Check results
      if(!is.null(qtlfit$result.drop)){
        # Announce
        print("Checking drop-one analysis for significance")
        
        # Make a dataframe of the drop results
        a <- as.data.frame(qtlfit$result.drop)
        
        # Check significance 
        a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
        
        # Check significance 
        a <- data.frame(name=rownames(a[a$sig==0,]))
        
        # Separate the column name into sections 
        a <- tidyr::separate(data = a, 
                             col = "name",
                             into = c("chr", "trash", "pos"),
                             sep = "-")
        
        # Make sure position is a number
        a$pos <- as.numeric(a$pos)
        
        # Make the chromosome object from the trait
        a$chr <- gsub(paste("MQM", j, "_", sep = ""),"",a$chr)
        
        # Drop the insignificant QTL from the object
        madeqtl <- dropfromqtl(madeqtl,
                               chr = a$chr,
                               pos = a$pos)
        
        # Add the significant QTL to the object
        madeqtl <- addtoqtl(cross_file,
                            qtl = madeqtl,
                            chr = qtl_check$chr,
                            pos = qtl_check$pos,
                            qtl.name = qtl_check$name)
              
        
        # Add this QTL object to the list of list
        results[[paste("MQM", j, sep="")]]$qtl[[i]] <- madeqtl 
        
        # Remove temporary dataframes
        remove(a, c, p)
        }else{
          # Announce 
          print(paste("There was only one new QTL identified for ",
                      i,
                      " in ", 
                      paste("MQM", j, sep = ""),
                      "... Checking significance!",
                      sep = ""))
          
          # If this QTL is significant
          if(qtlfit$result.full[1,6]<0.05){
            # Announce
            print("New QTL is significant, placing in total model!")
            
            # Add that significant peak to the QTL object
            madeqtl <- addtoqtl(cross_file,
                                qtl = madeqtl,
                                chr = qtl_check$chr,
                                pos = qtl_check$pos,
                                qtl.name = qtl_check$name)
            
            # Add the object to the list of list
            results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- madeqtl 
            }else{
              # Make the multiple QTL model NULL
              results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- NULL 
              
              # Announce
              print(paste("There were no new QTL identified for", i, "concluding loop."))
              
              # Break loop 
              break
            }
          }
        }
      
    
    # Add result to object to check
    qtl_check <- results[[paste("MQM", j, sep="")]]$qtl[[i]]
    
    # Add 1 to the j vector to indicate what round we are on
    j=j+1
  }
  
  # Check
  if(j-1==0){
    # Pull and make final qtl object
    finalqtl <- results$IM$qtl[[i]]
  }else{
    # Pull and make final qtl object
    finalqtl <- results[[paste("MQM", j-1, sep="")]]$qtl[[i]]
      
  }
  
  # Check for significance
  qtlfit <- fitqtl(cross_file, 
                   qtl = finalqtl, 
                   pheno.col = i, 
                   get.ests = T,
                   model = "normal", 
                   method = "hk") 
  
  # Rename the QTL
  a <- finalqtl
  a <- data.frame(summary(a))
  a <- tidyr::separate(a, col = "name", into=c("model", "trash"), sep = "_")
  a$name <- paste(a$model, "_", a$chr, "-pos-", a$pos, sep = "")
  finalqtl$name = a$name
  remove(a)
  
  # Announce
  print("Filtering insignificant markers...")
  
  # If there are drop one analysis results
  if(!is.null(qtlfit$result.drop)){
    # Pull results into a dataframe
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the significant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Select the insignificant markers 
    a <- data.frame(name=rownames(a[a$sig==0,]))
    
    # Remove those QTL from the final QTL object
    finalqtl <- dropfromqtl(finalqtl,
                            qtl.name = a$name)
    
    # Add this to the list of list
    results$final$qtl_unrefine[[i]] <- finalqtl 
    
    # Remove the object
    remove(a, finalqtl)
  }else{
    # Put the final object in the list of list
    results$final$qtl_unrefine[[i]] <- finalqtl
    
    # Remove the object finalqtl
    remove(finalqtl)
  }
   
  # Announce
  print("Refining QTL position...")
  
  # Refine the QTL with the refine 
  results$final$qtl_refine[[i]] <- refineqtl(cross = cross_file, 
                                             pheno.col = i, 
                                             qtl = results$final$qtl_unrefine[[i]], 
                                             verbose = FALSE,
                                             method = "hk")
  # Rename the QTL
  a <- results$final$qtl_refine[[i]]
  a <- data.frame(summary(a))
  a <- tidyr::separate(a, col = "name", into=c("model", "trash"), sep = "_")
  a$name <- paste(a$model, "_", a$chr, "-pos-", a$pos, sep = "")
  results$final$qtl_refine[[i]]$name <- a$name
  remove(a)
  
  # Final significance check
  qtlfit <- fitqtl(cross_file, 
                   qtl = results$final$qtl_refine[[i]], 
                   pheno.col = i, 
                   get.ests = T,
                   model = "normal", 
                   method = "hk") 
  
  # Put the final QTL object into finalqtl
  finalqtl <- results$final$qtl_refine[[i]]
  
  # If there are drop one analysis results
  if(!is.null(qtlfit$result.drop)){
    # Pull results into a dataframe
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the significant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Select the insignificant markers 
    a <- data.frame(name=rownames(a[a$sig==0,]))
    
    # Remove those QTL from the final QTL object
    finalqtl <- dropfromqtl(finalqtl,
                            qtl.name = a$name)
    
    # Add this to the list of list
    results$final$qtl_refine_filt[[i]] <- finalqtl 
    
    # Remove the object
    remove(a, finalqtl)
  }else{
    # Put the final object in the list of list
    results$final$qtl_refine_filt[[i]] <- finalqtl
    
    # Remove the object finalqtl
    remove(finalqtl)
  }
   
  # Create an object for support LOD internvals 
  droplodint<-c()
  
  #create QTL 1.5 drop LOD intervals
  for(z in results$final$qtl_refine_filt[[i]]$name){
    # Pull data for specific QTL
    a <- data.frame(name = z)
    
    # Pull the scan name 
    a <- tidyr::separate(data = a,
                         col = "name",
                         into = c("scan", "other"),
                         sep = "_",
                         remove = FALSE)
    
    # Pull the position name
    a <- tidyr::separate(data = a,
                         col = "other",
                         into = c("chr", "trash", "pos"),
                         sep = "-",
                         remove = TRUE)
    
    # Pull the relevant scan 
    b <- results[[a$scan]]$scan[[i]]
    
    # Find the nearest sudo marker to the LOD peak
    c <- find.pseudomarker(cross = cross_file,
                           chr = a$chr,
                           pos = as.numeric(a$pos))
    
    # Pull the confidence interval for 1.5 LOD drop
    d <- lodint(results = b,
                chr = a$chr,
                qtl.index = c,
                drop = 1.5,
                lodcolumn = 1,
                expandtomarkers = TRUE)
    
    # Create a dataframe with that data
    d <- data.frame(name = z, 
                    trait = i,
                    chr = unique(d$chr),
                    start_marker = rownames(d)[1],
                    start = d[1,2], 
                    mid_marker = rownames(d)[2],
                    mid_pos = d[2,2],
                    stop_marker = rownames(d)[3],
                    stop = d[3,2])
    
    # Bind into lodint object
    droplodint <- rbind(droplodint, d)
    
    # Remove temporary data
    remove(a,b,c,d)
  }
  
  # Place in results
  results$final$qtl_support_intervals[[i]] <- droplodint
  
  # Remove
  remove(droplodint)
  
}
## [1] "------------ Interval Mapping of VR_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.
## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for VR_ME in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait VR_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_ME in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 1 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.

## [1] "------------ Interval Mapping of HD_ME ------------"
## [1] "Interval mapping..."
## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."

## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## [1] "-------- Performing Additional QTL Scan for Trait HD_ME --------"
## [1] "Plotting..."
## [1] "Done"

## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## [1] "There was only one new QTL identified for HD_ME in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait HD_ME --------"
## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for HD_ME aborting loop"
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## [1] "------------ Interval Mapping of PH_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait PH_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for PH_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_KIN19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of HD_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 4 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait HD_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 4 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for HD_KIN20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait HD_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 4 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for HD_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_KIN20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_KIN20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of PH_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait PH_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for PH_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of HD_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait HD_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for HD_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait HD_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for HD_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_RAL19 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of HD_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait HD_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for HD_RAL20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait HD_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for HD_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 3 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 9 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of PH_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 4 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait PH_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 4 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for PH_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_WAR19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_WAR19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_WAR19 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_WAR19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_WAR19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_WAR19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of HD_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait HD_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for HD_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 2 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.

# Rename results
results_HD_PH_VR_FDK_DON<-results

# Remove results
remove(results)

Pull HD and PH Marker Covariates

# Pull QTL Support Intervals
covars <- rbind(results_HD_PH_VR_FDK_DON$final$qtl_support_intervals$HD_ME,
                results_HD_PH_VR_FDK_DON$final$qtl_support_intervals$PH_ME)

# Make a dataframe 
covar_markers <- data.frame(GENOTYPE = cross_file$pheno$GENOTYPE)

# For each QTL support intervals
for(i in 1:nrow(covars)){
  # Take this row
  a <- covars[i,]
  
  # Then fill in the genome
  b <- fill.geno(cross = cross_file,
                 method = c("no_dbl_XO"),
                 map.function = "kosambi")
  
  # Pull the cross for the specific genome
  b <- pull.geno(cross = b,
                 chr = a$chr)
  
  # Pull the marker name
  a <- find.marker(cross = cross_file,
                   chr = a$chr,
                   pos = a$mid_pos)
  
  # Pull the data frame
  b <- as.data.frame(b[,a])
  
  # Rename the column
  colnames(b) <- a
  
  # Bind it into the dataframe
  covar_markers <- cbind(covar_markers, b)
  
  # Remove the temporary data
  remove(a, b)
}

Visualize HD and PH QTL

# Pull vector of traits
traits <- names(cross_file$pheno)[c(grep("HD", names(cross_file$pheno)),
                                    grep("PH", names(cross_file$pheno)))]

# Make a color pallet
color_palette <- c(
  "HD_ME" = "#0000FF",        # Blue
  "HD_RAL19" = "#2F4F4F",     # DarkSlateGray
  "HD_RAL20" = "#00FFFF",     # Cyan
  "HD_KIN20" = "#1E90FF",     # DodgerBlue
  "HD_WAR20" = "#5F9EA0",     # CadetBlue
  "PH_ME" = "#EE82EE",        # Violet
  "PH_RAL20" = "#BA55D3",     # MediumOrchid
  "PH_KIN20" = "#9932CC"      # DarkOrchid
)

# Make temp list out of results 
dat_temp <- results_HD_PH_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_"))

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j = j + 1
}

# Create final plot
a <- (finalplot$chr_4A+
        finalplot$chr_5A+
        finalplot$chr_6A+
        finalplot$chr_6D+
        finalplot$chr_7A+
        finalplot$chr_7B)+
    plot_layout(guides = "collect", 
                nrow = 1)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH) and Heading Date (HD)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_hd_and_ph.jpg",
       width = 14,
       height = 8,
       dpi = 320,
       units = "in")

Visualize HD and PH QTL for ME only

# Pull vector of traits
traits <- c("HD_ME", "PH_ME")

# Make a color pallet
color_palette <- c(
  "Heading Date" = "#0000FF",        # Blue
  "Plant Height" = "#EE82EE"         # Violet
)

# Make temp list out of results 
dat_temp <- results_HD_PH_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_")) %>%
  mutate(trait=ifelse(trait=="HD_ME", "Heading Date",
                    ifelse(trait=="PH_ME", "Plant Height", "ERROR")))

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j=j+1
}

# Create final plot
a <- (finalplot$chr_4A+
        finalplot$chr_5A+
        finalplot$chr_6A+
        finalplot$chr_6D+
        finalplot$chr_7B)+
    plot_layout(guides = "collect", 
                nrow = 1)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH) and Heading Date (HD)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_hd_and_ph_ME_only.jpg",
       width = 14,
       height = 8,
       dpi = 320,
       units = "in")

Visualize HD, PH, VR, FDK, and DON

# Pull vector of traits
traits <- names(cross_file$pheno)[-1]

# Make a color pallet
color_palette <- c(
  "HD_ME" = "#0000FF",        # Blue
  "HD_RAL19" = "#2F4F4F",     # DarkSlateGray
  "HD_RAL20" = "#00FFFF",     # Cyan
  "HD_KIN20" = "#1E90FF",     # DodgerBlue
  "HD_WAR20" = "#5F9EA0",     # CadetBlue
  "PH_ME" = "#EE82EE",        # Violet
  "PH_RAL20" = "#BA55D3",     # MediumOrchid
  "PH_KIN20" = "#9932CC",     # DarkOrchid
  "VR_ME" = "#FF0000",        # Red
  "VR_KIN19" = "#8B0000",     # DarkRed
  "VR_KIN20" = "#B22280",     # Firebrick
  "VR_RAL19" = "#A0522D",     # Brown
  "VR_RAL20" = "#FF4500",     # OrangeRed
  "VR_WAR20" = "#FF6347",     # Tomato
  "FDK_ME" = "#FFFF00",       # Yellow
  "FDK_KIN19" = "#B8860B",    # DarkGoldenrod
  "FDK_KIN20" = "#FFD700",    # Gold
  "FDK_RAL19" = "#DAA520",    # Goldenrod
  "FDK_RAL20" = "#F0E68C",    # Khaki
  "FDK_WAR19" = "#EEE8AA",    # PaleGoldenrod
  "FDK_WAR20" = "#8B864E",    # Khaki4
  "DON_ME" = "#00FF00",       # DarkGreen
  "DON_KIN19" = "#66CD00",    # Chartreuse3
  "DON_KIN20" = "#556B2F",    # DarkOliveGreen
  "DON_RAL19" = "#8FBC8F",    # DarkSeaGreen
  "DON_RAL20" = "#6B8E23",    # OliveDrab
  "DON_WAR19" = "#98FB98",    # PaleGreen
  "DON_WAR20" = "#00FF7F"     # SpringGreen1
)

# Make temp list out of results 
dat_temp <- results_HD_PH_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_"))

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j = j + 1
}

# Create final plot
a <- (finalplot$chr_1A+
        finalplot$chr_2A+
        finalplot$chr_2B+
        finalplot$chr_3A+
        finalplot$chr_3B+
        finalplot$chr_4A+
        finalplot$chr_5A+
        finalplot$chr_5B+
        finalplot$chr_6A+
        finalplot$chr_6D+
        finalplot$chr_7A+
        finalplot$chr_7B+
        finalplot$chr_7D)+
    plot_layout(guides = "collect", nrow = 4)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH), Heading Date (HD), Visual Rating (VR), Fusarium Damaged Kernels (FDK), and Deoxynivalenol Content (DON)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_hd_ph_vr_fdk_don_unadjusted.jpg",
       width = 20,
       height = 15,
       dpi = 320,
       units = "in")

# Remove
remove(dat_ggplot, dat_temp)

Visualize HD, PH, VR, FDK, and DON for ME only

# Pull vector of traits
traits <- c("HD_ME", "PH_ME", "VR_ME", "FDK_ME", "DON_ME")

# Make a color pallet
color_palette <- c(
  "Heading Date" = "#0000FF",                # Blue
  "Plant Height" = "#EE82EE",                # Violet
  "Visual Rating" = "#FF0000",               # Red  
  "Fusarium Damaged Kernels" = "#FFFF00",    # Yellow
  "Deoxynivalenol Content" = "#00FF00"       # Green
)


# Make temp list out of results 
dat_temp <- results_HD_PH_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_")) %>%
  mutate(trait=ifelse(trait=="HD_ME", "Heading Date",
                    ifelse(trait=="PH_ME", "Plant Height",
                           ifelse(trait=="VR_ME", "Visual Rating",
                                  ifelse(trait=="FDK_ME", "Fusarium Damaged Kernels",
                                         ifelse(trait=="DON_ME", "Deoxynivalenol Content", "ERROR"))))))

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j = j + 1
}

# Create final plot
a <- (finalplot$chr_1A+
        finalplot$chr_2A+
        finalplot$chr_2B+
        finalplot$chr_3A+
        finalplot$chr_3B+
        finalplot$chr_4A+
        finalplot$chr_5A+
        finalplot$chr_5B+
        finalplot$chr_6A+
        finalplot$chr_6D+
        finalplot$chr_7A+
        finalplot$chr_7B+
        finalplot$chr_7D)+
    plot_layout(guides = "collect", nrow = 4)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH), Heading Date (HD), Visual Rating (VR), Fusarium Damaged Kernels (FDK), and Deoxynivalenol Content (DON)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_hd_ph_vr_fdk_don_unadjusted_ME_only.jpg",
       width = 20,
       height = 15,
       dpi = 320,
       units = "in")

Percent variance calculations - HD, PH, VR, FDK, and DON without adjustment

# Pull all traits
traits <- names(cross_file$pheno)[-1]

# Make an object for support internvals
final_qtls <- c()

# For i in trait names
for(i in traits){
  # Pull temporary dataframe
  a <- results_HD_PH_VR_FDK_DON$final$qtl_support_intervals[[i]]
  
  # Format final QTL object
  final_qtls <- rbind(final_qtls, a)
  
  # Remove final object
  remove(a)
}

# Make an object for information
qtl_info_drop_one <- c()
qtl_info_full <- c()

# For i in final_qtls object
for(i in traits){
  # Pull data
  a <- results_HD_PH_VR_FDK_DON$final$qtl_refine_filt[[i]]
  
  # If a is NULL
  if(is.null(a)){
    # Move to next trait
    next
  }
  
  # Fit QTL
  b <- fitqtl(cross_file, 
              qtl =results_HD_PH_VR_FDK_DON$final$qtl_refine_filt[[i]], 
              pheno.col = i, 
              get.ests = T,
              model = "normal", 
              method = "hk") 
  
  # Get full model
  c <- as.data.frame(b$result.full)
  
  # Move effect into column name
  c$effect <- rownames(c)
  rownames(c) <- NULL
  
  # Get drop one 
  d <- as.data.frame(b$result.drop)
  
  # Move QTL name into column
  d$name <- rownames(d)
  rownames(d) <- NULL
  
  # Bind in data
  e <- results_HD_PH_VR_FDK_DON$final$qtl_support_intervals[[i]]
  
  # Left join
  d <- left_join(d, e, by = "name")
  
  # Add trait names to both full model
  c$trait <- i
  
  # Bind in data
  qtl_info_drop_one <- rbind(qtl_info_drop_one, d)
  qtl_info_full <- rbind(qtl_info_full, c)
  
  # Remove
  remove(a,b,c,d,e)
}
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 4 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
# Write file
write.csv(qtl_info_drop_one,
          "hd_ph_vr_fdk_don_drop_one_qtl_info_no_adjustment.csv",
          row.names = FALSE)

# Write file
write.csv(qtl_info_full,
          "hd_ph_vr_fdk_don_full_model_qtl_info_no_adjustment.csv",
          row.names = FALSE)

QTL analysis with HD and PH covariates - VR, FDK, DON

# Set the number of permutations
nperms=1000

# Pull traits
traits<-names(cross_file$pheno)[c(grep("VR", names(cross_file$pheno)),
                                  grep("FDK", names(cross_file$pheno)),
                                  grep("DON", names(cross_file$pheno)))]

# Covariates - set to null if none are specified 
qtl_covariates <- covar_markers[,2:ncol(covar_markers)]

# Make results vector
results<-list()

# Run initial interval mapping and pull out QTL
for (i in traits){
  
  # Announce 
  print(paste("------------ Interval Mapping of", i,"------------"))
  
  # Perform IM with multiple imputation method
  print("Interval mapping...")
  scans <- scanone(cross_file, 
                   pheno.col = i,
                   addcovar = qtl_covariates,
                   model = "normal", 
                   method = "hk") 
  print("Done")
  
  # Perform IM permutations mapping to define significance threshold
  print("Permutational interval mapping...")
  perms <- scanone(cross_file, 
                   pheno.col = i, 
                   addcovar = qtl_covariates,
                   model = "normal", 
                   method = "hk", 
                   n.perm = nperms, 
                   n.cluster = parallel::detectCores()-1) #set threshold
  print("Done")
  
  # Plot QTL Scan
  print("Plotting...")
  threshold <- summary(perms, alpha=0.05)
  plot(scans,main=paste("IM for", i)) 
  abline(h = threshold, lty = "dotted", lwd = 1, col="#cc0000")
  legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
  
  # Print plot
  jpeg(paste("Scan_IM_", i, "_With_Adjustment.jpg", sep = ""),
       width = 11,
       height = 4,
       units = "in",
       res = 320)
  threshold <- summary(perms, alpha=0.05)
  plot(scans, main = paste("IM for", i)) 
  abline(h = threshold, lty = "dotted", lwd = 1, col = "#cc0000")
  legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
  dev.off()
  print("Done")
  
  # Show the peak markers for QTL
  print("Defining QTL...")
  qtl <- summary(scans, 
                 perm = perms, 
                 lodcolum = 1, 
                 alpha=0.05)
  
  # Place outputs in lists
  results$IM$scan[[i]] <- scans # Place the scan a the list
  results$IM$perms[[i]] <- perms # Place the permutations a the list
  results$IM$threshold[[i]] <- threshold # Place the thresholds a the list
  
  # If not QTL is found
  if(nrow(qtl)==0){
    # Print out
    print("No QTL identified in initial scan... Moving onto next trait!")
    next
  }
  
  # Rename QTL to identify which scan they came from
  qtl$name <- paste("IM_", qtl$chr, "-pos-", qtl$pos, sep = "")
  print("Done")
  
  # Define the QTL locations and effects
  print("Drawing QTL...")
  colnames(scans) <- c("chr", "pos", "lod")
  
  # Set up objects for defining QTL
  c <- qtl[,1] # Define the chromosomes where QTL are found
  p <- qtl[,2] # Define the positions of the QTL
  a <- subset(cross_file, chr=c) # Subset the chromosomes where QTL are found
  
  # Make new cross with genome subset
  a <- sim.geno(a, 
                n.draws = 128, 
                step = 2, 
                off.end = 0.0, 
                error.prob = 1.0e-4, 
                map.function = "kosambi", 
                stepwidth = "fixed")
  
  # Make a QTL object from that subset
  madeqtl <- makeqtl(a, 
                     c, 
                     p, 
                     qtl.name = qtl[,4], 
                     what = c("prob")) 

  # Place that QTL object in a list
  results$IM$qtl[[i]] <- madeqtl 
  print("Done")
  
  # Announce
  print("Running drop-one QTL analysis to check significance...")
  
  # Test the significance of those QTL using drop one analysis
  qtlfit <- fitqtl(cross_file, 
                   qtl = results$IM$qtl[[i]], 
                   pheno.col = i,
                   model = "normal", 
                   method = "hk") 
  
  # Remove insignificant QTL
  if(!is.null(qtlfit$result.drop)){
    # Make an object of the drop results of the fit QTL object
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the insignificant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Make a dataframe with insignificant QTL
    a <- data.frame(name = rownames(a[a$sig==0,]))
    
    # Drop those QTL
    madeqtl <- dropfromqtl(madeqtl,
                           qtl.name = a$name)
    
    # Put that in object
    results$IM$qtl[[i]] <- madeqtl 
    
    # Remove temporary 
    remove(a,c,p,scans,perms,threshold)
  }else{
    # Remove temporary dataframes
    remove(a,c,p,scans,perms,threshold)
  }
  
  # Set vectors outside the loop
  j=1
  
  # Make initial check object
  qtl_check<-results$IM$qtl[[i]]
  
  # Run MQM until no significant peaks
  repeat{
    
    # Announce  
    print(paste("-------- Performing Additional QTL Scan for Trait", i,"--------"))
    
    # Run multiple QTL mapping
    mqm <- addqtl(cross = cross_file, 
                  pheno.col = i, 
                  qtl = qtl_check, 
                  covar = qtl_covariates, 
                  method = "hk")
    
    # Put that in the list
    results[[paste("MQM", j, sep="")]]$scan[[i]] <- mqm
    
    # Plot QTL Scan
    print("Plotting...")
    plot(mqm, main = paste("MQM", j, "for", i)) 
    abline(h = results$IM$threshold[[i]], lty = "dotted", lwd = 1, col = "#cc0000")
    legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
    print("Done")
    
    # Write out picture to directory
    jpeg(paste("Scan_",paste("MQM", j, sep=""),"_", i, "_With_Adjustment.jpg", sep = ""),
     width = 11,
     height = 4,
     units = "in",
     res = 320)
    plot(mqm, main = paste("MQM", j, "for", i)) 
    abline(h = results$IM$threshold[[i]], lty = "dotted", lwd = 1, col = "#cc0000")
    legend("topleft",legend = c("p=0.05"),col = c("#cc0000"),lty = "dotted")
    dev.off()

    #make a qtl object
    qtl <- summary(mqm, 
                   perm = results$IM$perms[[i]], 
                   lodcolum = 1, 
                   alpha = 0.05)
  
    if(nrow(qtl)==0){
      # Make a null object in the list of list
      results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- NULL
      
      # Announce
      print(paste("There were no new QTL identified for", i, "aborting loop"))
      
      # Break the loop
      break
    }else{
      # Rename QTL to identify which scan they came from
      qtl$name=paste(paste("MQM", j, "_", sep=""), qtl$chr,"-pos-",qtl$pos,sep="")
       
      # Defining QTL
      print("Drawing new QTL")
      c<-qtl[,1] # Define the chromosomes where QTL are found
      p<-qtl[,2] # Define the positions of the QTL
      a<-subset(cross_file, chr=c) # Subset the chromosomes where QTL are found
       
      # Simulate the genome for that subset
      a <- sim.geno(a, 
                    n.draws = 128, 
                    step = 2, 
                    off.end = 0.0, 
                    error.prob = 1.0e-4, 
                    map.function = "kosambi", 
                    stepwidth = "fixed") 
       
      # Make a QTL object from that subset
      madeqtl <- makeqtl(a, 
                         c, 
                         p, 
                         qtl.name = qtl[,4], 
                         what = c("prob")) 
   
      # Place that QTL object in a list
      results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- madeqtl 
      print("Done")
      
      # Announce
      print("Running drop-one QTL analysis...")
       
      # Test the significance of those QTL using dropone analysis
      qtlfit <- fitqtl(cross_file, 
                       qtl = madeqtl, 
                       pheno.col = i, 
                       get.ests = T,
                       model = "normal", 
                       method = "hk") 
      
      # Check results
      if(!is.null(qtlfit$result.drop)){
        # Announce
        print("Checking drop-one analysis for significance")
        
        # Make a dataframe of the drop results
        a <- as.data.frame(qtlfit$result.drop)
        
        # Check significance 
        a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
        
        # Check significance 
        a <- data.frame(name=rownames(a[a$sig==0,]))
        
        # Separate the column name into sections 
        a <- tidyr::separate(data = a, 
                             col = "name",
                             into = c("chr", "trash", "pos"),
                             sep = "-")
        
        # Make sure position is a number
        a$pos <- as.numeric(a$pos)
        
        # Make the chromosome object from the trait
        a$chr <- gsub(paste("MQM", j, "_", sep = ""),"",a$chr)
        
        # Drop the insignificant QTL from the object
        madeqtl <- dropfromqtl(madeqtl,
                               chr = a$chr,
                               pos = a$pos)
        
        # Add the significant QTL to the object
        madeqtl <- addtoqtl(cross_file,
                            qtl = madeqtl,
                            chr = qtl_check$chr,
                            pos = qtl_check$pos,
                            qtl.name = qtl_check$name)
              
        
        # Add this QTL object to the list of list
        results[[paste("MQM", j, sep="")]]$qtl[[i]] <- madeqtl 
        
        # Remove temporary dataframes
        remove(a, c, p)
        }else{
          # Announce 
          print(paste("There was only one new QTL identified for ",
                      i,
                      " in ", 
                      paste("MQM", j, sep = ""),
                      "... Checking significance!",
                      sep = ""))
          
          # If this QTL is significant
          if(qtlfit$result.full[1,6]<0.05){
            # Announce
            print("New QTL is significant, placing in total model!")
            
            # Add that significant peak to the QTL object
            madeqtl <- addtoqtl(cross_file,
                                qtl = madeqtl,
                                chr = qtl_check$chr,
                                pos = qtl_check$pos,
                                qtl.name = qtl_check$name)
            
            # Add the object to the list of list
            results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- madeqtl 
            }else{
              # Make the multiple QTL model NULL
              results[[paste("MQM", j, sep = "")]]$qtl[[i]] <- NULL 
              
              # Announce
              print(paste("There were no new QTL identified for", i, "concluding loop."))
              
              # Break loop 
              break
            }
          }
        }
      
    
    # Add result to object to check
    qtl_check <- results[[paste("MQM", j, sep="")]]$qtl[[i]]
    
    # Add 1 to the j vector to indicate what round we are on
    j=j+1
  }
  
  # Check
  if(j-1==0){
    # Pull and make final qtl object
    finalqtl <- results$IM$qtl[[i]]
  }else{
    # Pull and make final qtl object
    finalqtl <- results[[paste("MQM", j-1, sep="")]]$qtl[[i]]
      
  }
  
  # Check for significance
  qtlfit <- fitqtl(cross_file, 
                   qtl = finalqtl, 
                   pheno.col = i, 
                   get.ests = T,
                   model = "normal", 
                   method = "hk") 
  
  # Rename the QTL
  a <- finalqtl
  a <- data.frame(summary(a))
  a <- tidyr::separate(a, col = "name", into=c("model", "trash"), sep = "_")
  a$name <- paste(a$model, "_", a$chr, "-pos-", a$pos, sep = "")
  finalqtl$name = a$name
  remove(a)
  
  # Announce
  print("Filtering insignificant markers...")
  
  # If there are drop one analysis results
  if(!is.null(qtlfit$result.drop)){
    # Pull results into a dataframe
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the significant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Select the insignificant markers 
    a <- data.frame(name=rownames(a[a$sig==0,]))
    
    # Remove those QTL from the final QTL object
    finalqtl <- dropfromqtl(finalqtl,
                            qtl.name = a$name)
    
    # Add this to the list of list
    results$final$qtl_unrefine[[i]] <- finalqtl 
    
    # Remove the object
    remove(a, finalqtl)
  }else{
    # Put the final object in the list of list
    results$final$qtl_unrefine[[i]] <- finalqtl
    
    # Remove the object finalqtl
    remove(finalqtl)
  }
   
  # Announce
  print("Refining QTL position...")
  
  # Refine the QTL with the refine 
  results$final$qtl_refine[[i]] <- refineqtl(cross = cross_file, 
                                             pheno.col = i, 
                                             qtl = results$final$qtl_unrefine[[i]], 
                                             verbose = FALSE,
                                             method = "hk")
  # Rename the QTL
  a <- results$final$qtl_refine[[i]]
  a <- data.frame(summary(a))
  a <- tidyr::separate(a, col = "name", into=c("model", "trash"), sep = "_")
  a$name <- paste(a$model, "_", a$chr, "-pos-", a$pos, sep = "")
  results$final$qtl_refine[[i]]$name <- a$name
  remove(a)
  
  # Final significance check
  qtlfit <- fitqtl(cross_file, 
                   qtl = results$final$qtl_refine[[i]], 
                   pheno.col = i, 
                   get.ests = T,
                   model = "normal", 
                   method = "hk") 
  
  # Put the final QTL object into finalqtl
  finalqtl <- results$final$qtl_refine[[i]]
  
  # If there are drop one analysis results
  if(!is.null(qtlfit$result.drop)){
    # Pull results into a dataframe
    a <- as.data.frame(qtlfit$result.drop)
    
    # Find the significant QTL
    a$sig <- ifelse(a$`Pvalue(F)`<0.05, 1, 0)
    
    # Select the insignificant markers 
    a <- data.frame(name=rownames(a[a$sig==0,]))
    
    # Remove those QTL from the final QTL object
    finalqtl <- dropfromqtl(finalqtl,
                            qtl.name = a$name)
    
    # Add this to the list of list
    results$final$qtl_refine_filt[[i]] <- finalqtl 
    
    # Remove the object
    remove(a, finalqtl)
  }else{
    # Put the final object in the list of list
    results$final$qtl_refine_filt[[i]] <- finalqtl
    
    # Remove the object finalqtl
    remove(finalqtl)
  }
   
  # Create an object for support LOD internvals 
  droplodint<-c()
  
  #create QTL 1.5 drop LOD intervals
  for(z in results$final$qtl_refine_filt[[i]]$name){
    # Pull data for specific QTL
    a <- data.frame(name = z)
    
    # Pull the scan name 
    a <- tidyr::separate(data = a,
                         col = "name",
                         into = c("scan", "other"),
                         sep = "_",
                         remove = FALSE)
    
    # Pull the position name
    a <- tidyr::separate(data = a,
                         col = "other",
                         into = c("chr", "trash", "pos"),
                         sep = "-",
                         remove = TRUE)
    
    # Pull the relevant scan 
    b <- results[[a$scan]]$scan[[i]]
    
    # Find the nearest sudo marker to the LOD peak
    c <- find.pseudomarker(cross = cross_file,
                           chr = a$chr,
                           pos = as.numeric(a$pos))
    
    # Pull the confidence interval for 1.5 LOD drop
    d <- lodint(results = b,
                chr = a$chr,
                qtl.index = c,
                drop = 1.5,
                lodcolumn = 1,
                expandtomarkers = TRUE)
    
    # Create a dataframe with that data
    d <- data.frame(name = z, 
                    trait = i,
                    chr = unique(d$chr),
                    start_marker = rownames(d)[1],
                    start = d[1,2], 
                    mid_marker = rownames(d)[2],
                    mid_pos = d[2,2],
                    stop_marker = rownames(d)[3],
                    stop = d[3,2])
    
    # Bind into lodint object
    droplodint <- rbind(droplodint, d)
    
    # Remove temporary data
    remove(a,b,c,d)
  }
  
  # Place in results
  results$final$qtl_support_intervals[[i]] <- droplodint
  
  # Remove
  remove(droplodint)
  
}
## [1] "------------ Interval Mapping of VR_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.
## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait VR_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 10 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for VR_KIN20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for VR_KIN20 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait VR_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for VR_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait VR_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of VR_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait VR_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for VR_WAR20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait VR_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for VR_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_ME in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_ME in MQM3... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 10 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_KIN19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 10 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_KIN19 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 10 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_RAL19 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_WAR19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for FDK_WAR19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_WAR19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of FDK_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait FDK_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for FDK_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_ME ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 1 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_ME in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_ME --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 8 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_ME aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_KIN19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 10 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_KIN19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_KIN20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 3 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Checking drop-one analysis for significance"
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_KIN20 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_KIN20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_KIN20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_RAL19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_RAL19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_RAL19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_RAL20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 9 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 6 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 15 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_RAL20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 15 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_RAL20 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_RAL20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 15 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_RAL20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_WAR19 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_WAR19 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_WAR19 in MQM2... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR19 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_WAR19 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "------------ Interval Mapping of DON_WAR20 ------------"
## [1] "Interval mapping..."
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 2 individuals with missing phenotypes.
## Warning in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata, : Dropping 7 individuals with missing covariates.

## [1] "Done"
## [1] "Permutational interval mapping..."
##  -Running permutations via a cluster of 11 nodes.
## [1] "Done"
## [1] "Plotting..."
## [1] "Done"
## [1] "Defining QTL..."
## [1] "Done"
## [1] "Drawing QTL..."
## [1] "Done"
## [1] "Running drop-one QTL analysis to check significance..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "Drawing new QTL"
## [1] "Done"
## [1] "Running drop-one QTL analysis..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "There was only one new QTL identified for DON_WAR20 in MQM1... Checking significance!"
## [1] "New QTL is significant, placing in total model!"
## [1] "-------- Performing Additional QTL Scan for Trait DON_WAR20 --------"
## Warning in addqtl(cross = cross_file, pheno.col = i, qtl = qtl_check, covar = qtl_covariates, : Dropping 9 individuals with missing phenotypes.

## [1] "Plotting..."
## [1] "Done"
## [1] "There were no new QTL identified for DON_WAR20 aborting loop"
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## [1] "Filtering insignificant markers..."
## [1] "Refining QTL position..."
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.

# Rename results
results_VR_FDK_DON <- results

# Remove results
remove(results)

Visualize FHB, FDK, and DON QTL

#make object for ggplot
traits <- names(cross_file$pheno)[c(grep("VR", names(cross_file$pheno)),
                                    grep("FDK", names(cross_file$pheno)),
                                    grep("DON", names(cross_file$pheno)))]

# Make a color pallet
color_palette <- c(
  # "HD_ME" = "#0000FF",        # Blue
  # "HD_RAL19" = "#2F4F4F",     # DarkSlateGray
  # "HD_RAL20" = "#00FFFF",     # Cyan
  # "HD_KIN20" = "#1E90FF",     # DodgerBlue
  # "HD_WAR20" = "#5F9EA0",     # CadetBlue
  # "PH_ME" = "#EE82EE",        # Violet
  # "PH_RAL20" = "#BA55D3",     # MediumOrchid
  # "PH_KIN20" = "#9932CC",     # DarkOrchid
  "VR_ME" = "#FF0000",        # Red
  "VR_KIN19" = "#8B0000",     # DarkRed
  "VR_KIN20" = "#B22280",     # Firebrick
  "VR_RAL19" = "#A0522D",     # Brown
  "VR_RAL20" = "#FF4500",     # OrangeRed
  "VR_WAR20" = "#FF6347",     # Tomato
  "FDK_ME" = "#FFFF00",       # Yellow
  "FDK_KIN19" = "#B8860B",    # DarkGoldenrod
  "FDK_KIN20" = "#FFD700",    # Gold
  "FDK_RAL19" = "#DAA520",    # Goldenrod
  "FDK_RAL20" = "#F0E68C",    # Khaki
  "FDK_WAR19" = "#EEE8AA",    # PaleGoldenrod
  "FDK_WAR20" = "#8B864E",    # Khaki4
  "DON_ME" = "#00FF00",       # DarkGreen
  "DON_KIN19" = "#66CD00",    # Chartreuse3
  "DON_KIN20" = "#556B2F",    # DarkOliveGreen
  "DON_RAL19" = "#8FBC8F",    # DarkSeaGreen
  "DON_RAL20" = "#6B8E23",    # OliveDrab
  "DON_WAR19" = "#98FB98",    # PaleGreen
  "DON_WAR20" = "#00FF7F"     # SpringGreen1
)

# Make temp list out of results 
dat_temp <- results_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_"))

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j = j + 1
}

# Create final plot
a <- (finalplot$chr_1A+
        finalplot$chr_2A+
        finalplot$chr_2B+
        finalplot$chr_2D+
        finalplot$chr_3A+
        finalplot$chr_3B+
        finalplot$chr_4A+
        finalplot$chr_4B+
        finalplot$chr_5A+
        finalplot$chr_5B+
        finalplot$chr_7A+
        finalplot$chr_7D)+
    plot_layout(guides = "collect", nrow = 4)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH), Heading Date (HD), Visual Rating (VR), Fusarium Damaged Kernels (FDK), and Deoxynivalenol Content (DON)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_vr_fdk_don_with_adjustment.jpg",
       width = 20,
       height = 15,
       dpi = 320,
       units = "in")

# Remove
remove(dat_ggplot, dat_temp)

Visualize FHB, FDK, and DON QTL for ME only

# Pull traits
traits<-c("VR_ME", "FDK_ME", "DON_ME")

# Make a color pallet
color_palette <- c(
  # "Heading Date" = "#0000FF",                # Blue
  # "Plant Height" = "#EE82EE",                # Violet
  "Visual Rating" = "#FF0000",               # Red  
  "Fusarium Damaged Kernels" = "#FFFF00",    # Yellow
  "Deoxynivalenol Content" = "#00FF00"       # Green
)

# Make temp list out of results 
dat_temp <- results_VR_FDK_DON

# Make object for ggplot formatted data
dat_ggplot <- c()

# For each trait
for(i in traits){
  # Pull a temporary dataframe 
  a <- dat_temp$final$qtl_support_intervals[[i]]
  # Rbind on results
  dat_ggplot <- rbind(dat_ggplot, a)
  # Remove 
  remove(a)
}

# Get a dataframe of the markers across the genome for this image
d <- dat_temp$IM$scan$VR_ME %>%
  filter(chr %in% dat_ggplot$chr)

# Mutate chromosome so that it is both chromosome and trait
dat_ggplot <- dat_ggplot %>% 
  mutate(chr = paste(chr, trait, sep = "_")) %>%
  mutate(trait=ifelse(trait=="HD_ME", "Heading Date",
                    ifelse(trait=="PH_ME", "Plant Height",
                           ifelse(trait=="VR_ME", "Visual Rating",
                                  ifelse(trait=="FDK_ME", "Fusarium Damaged Kernels",
                                         ifelse(trait=="DON_ME", "Deoxynivalenol Content", "ERROR"))))))  

# Create a list for images
finalplot <- list()

# Set an external vector
j = 1

# For i in unique chromosomes 
for(i in unique(d$chr)){
  # Pull a temporary dataframe
  a <- dat_ggplot[grep(i, dat_ggplot$chr),]
  
  # Redefine trait with color pallet levels
  a$trait <- factor(a$trait, levels = names(color_palette))
  
  # Only pull the chromosome listed in object d from above
  b <- d[d$chr==i,]
  
  # Remove all sudo-markers from b
  b <- b[-grep("loc", rownames(b)),]
  
  # Move the rownames into a column called markers 
  b <- rownames_to_column(b, var = "marker")
  
  # Make an object called label that is made from the covariates on that chromsomes
  Label<-colnames(covar_markers)[grep(i, colnames(covar_markers))]
  
  # If the external variable j is equal to 1
  if(j==1){
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank())+ # Get rid of the x-axis line
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment", # Name the legend 
           y = "cM") # Lable the y-axis as "cM"
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }
  # If j is not equal to 1
  }else{
    # Create first plot
    c <- ggplot(data = b, aes(x = chr, y = pos))+ # Make plot out of object b
      geom_point(size = 2)+ # Make points that represent the markers
      geom_line(linewidth = 1)+ # Make a line that represents the length of the linkage group 
      scale_y_reverse(limits = c(250,0), breaks = seq(250, 0, by = -10))+ # Scale the y axis 
      scale_color_manual(values = color_palette, # Set the values of the color palette
                         drop = FALSE)+ # and make it so that no levels are dropped
      geom_segment(data = a, # Read in data 
                   aes(x = chr, # Make the x the "chromosome" 
                       xend = chr, # Make the ending point that same "chromosome"
                       y = start, # Make the start the first position
                       yend = stop, # Make the stop the end positoin
                       color = trait), # Make the color related to the trait 
                   linewidth = 2, # Set line width to 2
                   show.legend = TRUE)+ # Visualize QTL confidence intervals
      theme_classic()+ # Add the classic theme 
      theme(axis.title.x = element_blank(), # Get rid of the x-axis title
            axis.text.x = element_blank(), # Get rid of the x-axis text
            axis.ticks.x = element_blank(), # Get rid of the x-axis ticks
            axis.line.x = element_blank(), # Get rid of the x-axis line
            axis.title.y = element_blank())+ # Get rid of the y-axis title
      labs(title = i, # Make the title of the graph the name of the chromosome 
           color = "Trait Within Environment") # Name the legend 
    
    # If label exists   
    if(length(Label)>0){
      # Add a green point for HD and PH covariates 
      c <- c+
        geom_point(data = d[rownames(d) %in% Label,], 
                   aes(x = chr, y = pos), 
                   color = "green", 
                   size = 4, 
                   shape = 17)
    }    
  }
  # Add to the object finalplot and name it 
  finalplot[[paste("chr",i,sep="_")]] <- c
  
  # Remove temporary dataframes 
  remove(a,b,c)
  
  # Add 1 to j 
  j = j + 1
}

# Create final plot
a <- (finalplot$chr_1A+
        finalplot$chr_2A+
        finalplot$chr_2B+
        finalplot$chr_2D+
        finalplot$chr_3A+
        finalplot$chr_3B+
        finalplot$chr_4A+
        finalplot$chr_4B+
        finalplot$chr_5A+
        finalplot$chr_5B+
        finalplot$chr_7A+
        finalplot$chr_7D)+
    plot_layout(guides = "collect", nrow = 4)+
    plot_annotation(title = "1.5-LOD Support Intervals",
                    subtitle = "Plant Height (PH), Heading Date (HD), Visual Rating (VR), Fusarium Damaged Kernels (FDK), and Deoxynivalenol Content (DON)")

# Visualize final plot
a

# Save output
ggsave(plot = a,
       filename = "support_intervals_vr_fdk_don_with_adjustment_ME_only.jpg",
       width = 20,
       height = 15,
       dpi = 320,
       units = "in")

# Remove
remove(dat_ggplot, dat_temp)

Percent variance calculations - VR, FDK, and DON with adjustment

# Pull all traits
traits <- names(cross_file$pheno)[c(grep("VR", names(cross_file$pheno)),
                                    grep("FDK", names(cross_file$pheno)),
                                    grep("DON", names(cross_file$pheno)))]

# Make an object for support interval
final_qtls <- c()

# For i in trait names
for(i in traits){
  # Pull temporary dataframe
  a <- results_VR_FDK_DON$final$qtl_support_intervals[[i]]
  
  # Format final QTL object
  final_qtls <- rbind(final_qtls, a)
  
  # Remove final object
  remove(a)
}

# Make an object for information
qtl_info_drop_one_adj <- c()
qtl_info_full_adj <- c()

# For i in final_qtls object
for(i in traits){
  # Pull data
  a <- results_VR_FDK_DON$final$qtl_refine_filt[[i]]
  
  # If a is NULL
  if(is.null(a)){
    # Move to next trait
    next
  }
  
  # Fit QTL
  b <- fitqtl(cross_file, 
              qtl =results_VR_FDK_DON$final$qtl_refine_filt[[i]], 
              pheno.col = i, 
              get.ests = T,
              model = "normal", 
              method = "hk") 
  
  # Get full model
  c <- as.data.frame(b$result.full)
  
  # Move effect into column name
  c$effect <- rownames(c)
  rownames(c) <- NULL
  
  # Get drop one 
  d <- as.data.frame(b$result.drop)
  
  # Move QTL name into column
  d$name <- rownames(d)
  rownames(d) <- NULL
  
  # Bind in data
  e <- results_VR_FDK_DON$final$qtl_support_intervals[[i]]
  
  # Left join
  d <- left_join(d, e, by = "name")
  
  # Add trait names to both full model
  c$trait <- i
  
  # Bind in data
  qtl_info_drop_one_adj <- rbind(qtl_info_drop_one_adj, d)
  qtl_info_full_adj <- rbind(qtl_info_full_adj, c)
  
  # Remove
  remove(a,b,c,d,e)
}
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 1 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 3 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 9 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
## Warning in fitqtlengine(pheno = pheno, qtl = qtl, covar = covar, formula = formula, : Dropping 2 individuals with missing phenotypes.
# Write file
write.csv(qtl_info_drop_one_adj,
          "vr_fdk_don_drop_one_qtl_info_with_adjustment.csv",
          row.names = FALSE)

# Write file
write.csv(qtl_info_full_adj,
          "vr_fdk_don_full_model_qtl_info_with_adjustment.csv",
          row.names = FALSE)

Save analysis image

# Save image
save.image("Final_Analysis.RData")

Create marker table

# First report
GAWN_2015 <- readxl::read_excel("2015 5ST MDXN GAWN SUN Marker Report.xlsx",
                                sheet = "Table 1.4 GAWN Summary",
                                skip = 4,
                                .name_repair = 'minimal')
GAWN_2015 <- GAWN_2015[, colSums(is.na(GAWN_2015)) != nrow(GAWN_2015)]
GAWN_2015 <- GAWN_2015[,-c(1:4)]
GAWN_2015 <- as.data.frame(GAWN_2015[GAWN_2015$`Cultivar/Designation`=="GA06493-13LE6",])

# Second report
SUWWSN_2016 <- readxl::read_excel("2016 NUWWSN PNUWWSN SUWWSN Marker Report.xlsx",
                                  sheet = "Table 1.3 SUWWSN summary",
                                  skip = 4,
                                  .name_repair = 'minimal')
SUWWSN_2016 <- SUWWSN_2016[, colSums(is.na(SUWWSN_2016)) != nrow(SUWWSN_2016)]
SUWWSN_2016 <- SUWWSN_2016[,-c(1:4)]
SUWWSN_2016 <- as.data.frame(SUWWSN_2016[SUWWSN_2016$`Cultivar/Designation`=="NC13-20076",])

# Select calls
GAWN_2015 <- GAWN_2015[,c(1, 
                          grep("RHT", colnames(GAWN_2015), ignore.case = TRUE),
                          grep("PPD", colnames(GAWN_2015), ignore.case = TRUE),
                          grep("VRN", colnames(GAWN_2015), ignore.case = TRUE))]
SUWWSN_2016 <- SUWWSN_2016[,c(1, 
                              grep("RHT", colnames(SUWWSN_2016), ignore.case = TRUE),
                              grep("PPD", colnames(SUWWSN_2016), ignore.case = TRUE),
                              grep("VRN", colnames(SUWWSN_2016), ignore.case = TRUE))]

# Format
GAWN_2015 <- GAWN_2015[1,c(1:6, 9:ncol(GAWN_2015))] 
GAWN_2015[1,1:ncol(GAWN_2015)] <- c("GA06493-13LE6",
                                    "Tall",
                                    "Dwarf",
                                    "Photoperiod Sensitive", 
                                    "Photoperiod Sensitive",
                                    "Photoperiod Insensitive",
                                    "Long Vernalization",
                                    "Long Vernalization",
                                    "Long Vernalization")
SUWWSN_2016 <- SUWWSN_2016[1,c(1:6, 10:ncol(SUWWSN_2016))]
SUWWSN_2016[1,] <- c("NC13-20076",
                     "Tall",
                     "Dwarf",
                     "Photoperiod Sensitive", 
                     "Photoperiod Sensitive",
                     "Photoperiod Insensitive",
                     "Short Vernalization (2 Copies)",
                     "Long Vernalization",
                     "Long Vernalization")

# Marker Report
marker_report <- rbind(SUWWSN_2016, GAWN_2015)
marker_report <- as.data.frame(t(marker_report))
colnames(marker_report) <- marker_report[1,]
marker_report <- marker_report[-1,]
marker_report$Gene <- rownames(marker_report)
marker_report <- marker_report[, c("Gene", "NC13-20076", "GA06493-13LE6")]
rownames(marker_report) <- NULL
write.csv(marker_report,
          "parental_marker_report.csv",
          row.names = FALSE)

Make markdowns of supplemental material

Supplemental Information 1

# Create the Markdown content
markdown_content <- c("
---
title: \"Supplemental Information 1\"
output: pdf_document
---

## Description

Interval mapping (IM) and multiple-quantitative-trait-locus mapping (MQM) scans for heading date (HD) and plant height (PH), Fusarium head blight (FHB) visual ratings (VR), Fusarium damaged kernels (FDK), and deoxynivalenol (DON) content quantitative trait loci (QTL). Presented are the results of scans performed without heading date and plant height marker covariates. In the title of each graph is displayed which type of scan (IM vs MQM) and the trait which the scan belongs to. The number following MQM titles indicates which round of MQM the scan belongs to (e.g., MQM 2 is the second round of multiple QTL mapping). The y-axis displays the likelihood of odds (LOD) score of every position across the genome. The dotted line denotes the 1000 permutation significance threshold at alpha equals 0.05. If the significance threshold is not displayed within the graph, this indicates that all peaks detected in the QTL scan were below the significance threshold. This is usually apparent in the last MQM scan performed. The x-axis displays each linkage group, designated by their corresponding chromosome names (e.g., 1A, 1B, 1D, etc.). The rug of hash marks denotes the cM position of each marker in the recombination map.
")

for(i in traits){
  # Pull files
  temp1 <- list.files()
  
  # Grep files out
  temp1 <- temp1[grep(i, temp1)]
  temp1 <- temp1[grep(".jpg", temp1)]
  temp1 <- temp1[-grep("adjustment", temp1, ignore.case = TRUE)]
  
  # Make new line 
  temp2 <- unlist(str_split(i, "_"))
  temp2[temp2=="HD"] <- "Heading Date"
  temp2[temp2=="PH"] <- "Plant Height"
  temp2[temp2=="VR"] <- "Visual Ratings"
  temp2[temp2=="FDK"] <- "Fusarium Damaged Kernels"
  temp2[temp2=="DON"] <- "Deoxynivalenol Content"
  temp2[temp2=="KIN19"] <- "Kinston, NC - 2019"
  temp2[temp2=="KIN20"] <- "Kinston, NC - 2020"
  temp2[temp2=="RAL19"] <- "Raleigh, NC - 2019"
  temp2[temp2=="RAL20"] <- "Raleigh, NC - 2020"
  temp2[temp2=="WAR19"] <- "Warsaw, VA - 2019"
  temp2[temp2=="WAR20"] <- "Warsaw, VA - 2020"
  temp2[temp2=="ME"] <- "All Environments"
  
  # Create new line for markdown
  temp3 <- c("\n",
             paste("##", temp2[1], ifelse(temp2[2]=="All Environments", "Across" ,"in"), temp2[2]))
  
  # Add to that line
  for(j in temp1){
    # Add that line
    temp4 <- c(paste("![j](",j,")", sep = ""))
    
    # Bind in
    temp3 <- c(temp3, temp4)
    
    # Remove
    remove(temp4)
  }
  
  # Bind in
  markdown_content <- c(markdown_content, temp3)
  
  # Bind in new page break
  markdown_content <- c(markdown_content, "\\pagebreak")
  
  # Remove
  remove(temp1, temp2, temp3)
}

# Write the Markdown content to a file
writeLines(markdown_content, "supplemental_information_1.Rmd")

# Render the Markdown file to PDF
rmarkdown::render("supplemental_information_1.Rmd", output_format = "pdf_document")
## 
## 
## processing file: supplemental_information_1.Rmd
##   |                                                                              |                                                                      |   0%  |                                                                              |......................................................................| 100%
## output file: supplemental_information_1.knit.md
## "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS supplemental_information_1.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output supplemental_information_1.tex --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in"
## 
## Output created: supplemental_information_1.pdf

Supplemental Information 2

# Create the Markdown content
markdown_content <- c('
---
title: \"Supplemental Information 2\"
output: 
  pdf_document:
    extra_dependencies: ["geometry"]
    latex_engine: xelatex
geometry: landscape
---

## Description

A visualization of all 1.5-likelyhood-of-odds (1.5-LOD) support intervals drawn from peak positions of significant quantitative trait locus (QTL) identified for plant height (PH), heading date (HD), Fusarium head blight (FHB) visual ratings (VR), Fusarium damaged kernels (FDK), and deoxynivalenol (DON) content. This is a nieve model that does not include marker covariates. Both multi-environmental (ME) and within-environment scans were mapped in this image. Within environment scans included the Cunningham Research Station in Kinston, North Carolina in 2019 (KIN19) and 2020 (KIN20); the Lake Wheeler Field Laboratory in Raleigh, North Carolina in 2019 (RAL19) and 2020 (RAL20), and the Eastern Agricultural Research and Extension Center in Warsaw Virginia in 2019 (WAR19) and 2020 (WAR20). Support intervals are denoted by bars to the right of linkage groups. The y-axis displays a scale for length of linkage groups in centimorgans (cM). Each linkage group is displayed as a series of points (markers) and a connecting line (distance between markers). The length and position of the bar denotes the length and position of the QTL on the resultant linkage group, which is denoted by the title above the linkage group (e.g., 1B). The color of the corresponding support interval denotes the corresponding scan to which that interval belongs (e.g., heading date across environments = HD_ME). Markers labeled by green triangles denote peak QTL positions used as covariates in scans for visual rating of Fusarium head blight infection, Fusarium damaged kernels, and deoxynivalenol content. Covariate markers were selected based on their repeated occurrence across scans and their appearance in the multi-environmental scans of both plant height and heading date. 


![](support_intervals_hd_ph_vr_fdk_don_unadjusted.jpg)

')

# Write the Markdown content to a file
writeLines(markdown_content, "supplemental_information_2.Rmd")

# Render the Markdown file to PDF
rmarkdown::render("supplemental_information_2.Rmd", output_format = "pdf_document")
## 
## 
## processing file: supplemental_information_2.Rmd
##   |                                                                              |                                                                      |   0%  |                                                                              |......................................................................| 100%
## output file: supplemental_information_2.knit.md
## "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS supplemental_information_2.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output supplemental_information_2.tex --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine xelatex --variable graphics --include-in-header "C:\Users\zwinn\AppData\Local\Temp\RtmpO0mKtP\rmarkdown-str2ce04d0c31db.html"
## 
## Output created: supplemental_information_2.pdf

Supplemental Information 3

# Create the Markdown content
markdown_content <- c("
---
title: \"Supplemental Information 3\"
output: pdf_document
---

## Description

Interval mapping (IM) and multiple-quantitative-trait-locus mapping (MQM) scans for Fusarium head blight (FHB) disease resistance traits visual rating (VR), Fusarium damaged kernels (FDK), and deoxynivalenol (DON) content quantitative trait loci (QTL). In the title of each graph is displayed which type of scan (IM vs MQM) and the trait which the scan belongs to. The number following MQM titles indicates which round of MQM the scan belongs to (e.g., MQM 2 is the second round of multiple QTL mapping). The y-axis displays the likelihood of odds (LOD) score of every position across the genome. The dotted line denotes the 1000 permutation at alpha equals 0.05 significance threshold. If the significance threshold is not displayed within the graph, this indicates that all peaks detected in the QTL scan were below the significance threshold. This is usually apparent in the last MQM scan performed. The x-axis displays each linkage group, designated by their corresponding chromosome names (e.g., 1A, 1B, 1D, etc.). The rug of hash marks denotes the cM position of each marker in the recombination map.
")

for(i in traits[c(grep("VR", traits),
                  grep("FDK", traits),
                  grep("DON", traits))]){
  # Pull files
  temp1 <- list.files()
  
  # Grep files out
  temp1 <- temp1[grep(i, temp1)]
  temp1 <- temp1[grep(".jpg", temp1)]
  temp1 <- temp1[grep("adjustment", temp1, ignore.case = TRUE)]
  
  # Make new line 
  temp2 <- unlist(str_split(i, "_"))
  temp2[temp2=="VR"] <- "Visual Ratings"
  temp2[temp2=="FDK"] <- "Fusarium Damaged Kernels"
  temp2[temp2=="DON"] <- "Deoxynivalenol Content"
  temp2[temp2=="KIN19"] <- "Kinston, NC - 2019"
  temp2[temp2=="KIN20"] <- "Kinston, NC - 2020"
  temp2[temp2=="RAL19"] <- "Raleigh, NC - 2019"
  temp2[temp2=="RAL20"] <- "Raleigh, NC - 2020"
  temp2[temp2=="WAR19"] <- "Warsaw, VA - 2019"
  temp2[temp2=="WAR20"] <- "Warsaw, VA - 2020"
  temp2[temp2=="ME"] <- "All Environments"
  
  # Create new line for markdown
  temp3 <- c("\n",
             paste("##", temp2[1], ifelse(temp2[2]=="All Environments", "Across" ,"in"), temp2[2]))
  
  # Add to that line
  for(j in temp1){
    # Add that line
    temp4 <- c(paste("![j](",j,")", sep = ""))
    
    # Bind in
    temp3 <- c(temp3, temp4)
    
    # Remove
    remove(temp4)
  }
  
  # Bind in
  markdown_content <- c(markdown_content, temp3)
  
  # Bind in new page break
  markdown_content <- c(markdown_content, "\\pagebreak")
  
  # Remove
  remove(temp1, temp2, temp3)
}

# Write the Markdown content to a file
writeLines(markdown_content, "supplemental_information_3.Rmd")

# Render the Markdown file to PDF
rmarkdown::render("supplemental_information_3.Rmd", output_format = "pdf_document")
## 
## 
## processing file: supplemental_information_3.Rmd
##   |                                                                              |                                                                      |   0%  |                                                                              |......................................................................| 100%
## output file: supplemental_information_3.knit.md
## "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS supplemental_information_3.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output supplemental_information_3.tex --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in"
## 
## Output created: supplemental_information_3.pdf

Supplemental Information 4

# Create the Markdown content
markdown_content <- c('
---
title: \"Supplemental Information 4\"
output: 
  pdf_document:
    extra_dependencies: ["geometry"]
    latex_engine: xelatex
geometry: landscape
---

## Description

A visualization of all 1.5-likelyhood-of-odds (1.5-LOD) support intervals drawn from peak positions of significant quantitative trait locus (QTL) identified for Fusarium head blight (FHB) reaction traits visual rating (VR), Fusarium damaged kernels (FDK) and deoxynivalenol content (DON). Both multi-environmental (ME) and within-environment scans were mapped in this image. Within environment scans included the Cunningham Research Station in Kinston, North Carolina in 2019 (KIN2019) and 2020 (KIN2020); the Lake Wheeler Field Laboratory in Raleigh, North Carolina in 2019 (LW2019) and 2020 (LW2020), and the Eastern Agricultural Research and Extension Center in Warsaw Virginia in 2019 (VIR2019) and 2020 (VIR2020). Support intervals are denoted by bars to the right of linkage groups. The y-axis displays a scale for length of linkage groups in centimorgans (cM). Each linkage group is displayed as a series of points (markers) and a connecting line (distance between markers). The length and position of the bar denotes the length and position of the QTL on the resultant linkage group, which is denoted by the title above the linkage group (e.g., 1A). The color of the corresponding support interval denotes the corresponding scan to which that interval belongs (e.g., visual rating across environments = VR_ME).


![](support_intervals_vr_fdk_don_with_adjustment.jpg)

')

# Write the Markdown content to a file
writeLines(markdown_content, "supplemental_information_4.Rmd")

# Render the Markdown file to PDF
rmarkdown::render("supplemental_information_4.Rmd", output_format = "pdf_document")
## 
## 
## processing file: supplemental_information_4.Rmd
##   |                                                                              |                                                                      |   0%  |                                                                              |......................................................................| 100%
## output file: supplemental_information_4.knit.md
## "C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS supplemental_information_4.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output supplemental_information_4.tex --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\zwinn\AppData\Local\R\win-library\4.4\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine xelatex --variable graphics --include-in-header "C:\Users\zwinn\AppData\Local\Temp\RtmpO0mKtP\rmarkdown-str2ce076623475.html"
## 
## Output created: supplemental_information_4.pdf